Move zoom function inside closure so it isn't potentially knocked out by other functions (with same name) in global scope.
This commit is contained in:
parent
8a8a26e23a
commit
6a6480181d
@ -1,22 +1,7 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
$(".shm-zoomer").change(function(e) {
|
|
||||||
zoom(this.options[this.selectedIndex].value);
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".shm-main-image").click(function(e) {
|
|
||||||
switch($.cookie("ui-image-zoom")) {
|
|
||||||
case "full": zoom("width"); break;
|
|
||||||
default: zoom("full"); break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if($.cookie("ui-image-zoom")) {
|
|
||||||
zoom($.cookie("ui-image-zoom"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function zoom(zoom_type) {
|
function zoom(zoom_type) {
|
||||||
var img = $('.shm-main-image');
|
var img = $('.shm-main-image');
|
||||||
|
|
||||||
if(zoom_type == "full") {
|
if(zoom_type == "full") {
|
||||||
img.css('max-width', img.data('width') + 'px');
|
img.css('max-width', img.data('width') + 'px');
|
||||||
img.css('max-height', img.data('height') + 'px');
|
img.css('max-height', img.data('height') + 'px');
|
||||||
@ -38,3 +23,19 @@ function zoom(zoom_type) {
|
|||||||
|
|
||||||
$.cookie("ui-image-zoom", zoom_type, {path: '/', expires: 365});
|
$.cookie("ui-image-zoom", zoom_type, {path: '/', expires: 365});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(".shm-zoomer").change(function(e) {
|
||||||
|
zoom(this.options[this.selectedIndex].value);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".shm-main-image").click(function(e) {
|
||||||
|
switch($.cookie("ui-image-zoom")) {
|
||||||
|
case "full": zoom("width"); break;
|
||||||
|
default: zoom("full"); break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if($.cookie("ui-image-zoom")) {
|
||||||
|
zoom($.cookie("ui-image-zoom"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user