toggle zoom on click
This commit is contained in:
parent
8336fbfce5
commit
1d4836e6c4
@ -1,7 +1,13 @@
|
||||
$(function() {
|
||||
$("#zoomer").change(function(e) {
|
||||
zoom(this.options[this.selectedIndex].value);
|
||||
$.cookie("ui-image-zoom", this.options[this.selectedIndex].value, {path: '/', expires: 365});
|
||||
});
|
||||
|
||||
$("#main_image").click(function(e) {
|
||||
switch($.cookie("ui-image-zoom")) {
|
||||
case "full": zoom("width"); break;
|
||||
default: zoom("full"); break;
|
||||
}
|
||||
});
|
||||
|
||||
if($.cookie("ui-image-zoom")) {
|
||||
@ -17,15 +23,16 @@ function zoom(zoom) {
|
||||
img.css('max-height', img.data('height') + 'px');
|
||||
}
|
||||
if(zoom == "width") {
|
||||
img.css('max-width', '90%');
|
||||
img.css('max-width', '95%');
|
||||
img.css('max-height', img.data('height') + 'px');
|
||||
}
|
||||
if(zoom == "height") {
|
||||
img.css('max-width', img.data('width') + 'px');
|
||||
img.css('max-height', (window.innerHeight * 0.9) + 'px');
|
||||
img.css('max-height', (window.innerHeight * 0.95) + 'px');
|
||||
}
|
||||
if(zoom == "both") {
|
||||
img.css('max-width', '90%');
|
||||
img.css('max-height', (window.innerHeight * 0.9) + 'px');
|
||||
img.css('max-width', '95%');
|
||||
img.css('max-height', (window.innerHeight * 0.95) + 'px');
|
||||
}
|
||||
$.cookie("ui-image-zoom", zoom, {path: '/', expires: 365});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user