diff --git a/jquery.elevateZoom-3.0.3.min.js b/jquery.elevateZoom-3.0.3.min.js index b745810..70dbec9 100644 --- a/jquery.elevateZoom-3.0.3.min.js +++ b/jquery.elevateZoom-3.0.3.min.js @@ -1,60 +1,36 @@ /* jQuery elevateZoom 3.0.3 - Demo's and documentation: - www.elevateweb.co.uk/image-zoom - Copyright (c) 2013 Andrew Eades - www.elevateweb.co.uk - Dual licensed under the LGPL licenses. - http://en.wikipedia.org/wiki/MIT_License - http://en.wikipedia.org/wiki/GNU_General_Public_License */ "function"!==typeof Object.create&&(Object.create=function(d){function h(){}h.prototype=d;return new h}); -(function(d,h,l,m){var k={init:function(b,a){var c=this;c.elem=a;c.$elem=d(a);c.imageSrc=c.$elem.data("zoom-image")?c.$elem.data("zoom-image"):c.$elem.attr("src");c.options=d.extend({},d.fn.elevateZoom.options,b);c.options.tint&&(c.options.lensColour="none",c.options.lensOpacity="1");"inner"==c.options.zoomType&&(c.options.showLens=!1);c.$elem.parent().removeAttr("title").removeAttr("alt");c.zoomImage=c.imageSrc;c.refresh(1);d("#"+c.options.gallery+" a").click(function(a){c.options.galleryActiveClass&& -(d("#"+c.options.gallery+" a").removeClass(c.options.galleryActiveClass),d(this).addClass(c.options.galleryActiveClass));a.preventDefault();d(this).data("zoom-image")?c.zoomImagePre=d(this).data("zoom-image"):c.zoomImagePre=d(this).data("image");c.swaptheimage(d(this).data("image"),c.zoomImagePre);return!1})},refresh:function(b){var a=this;setTimeout(function(){a.fetch(a.imageSrc)},b||a.options.refresh)},fetch:function(b){var a=this,c=new Image;c.onload=function(){a.largeWidth=c.width;a.largeHeight= -c.height;a.startZoom();a.currentImage=a.imageSrc;a.options.onZoomedImageLoaded(a.$elem)};c.src=b},startZoom:function(){var b=this;b.nzWidth=b.$elem.width();b.nzHeight=b.$elem.height();b.isWindowActive=!1;b.isLensActive=!1;b.isTintActive=!1;b.overWindow=!1;b.options.imageCrossfade&&(b.zoomWrap=b.$elem.wrap('
'),b.$elem.css("position","absolute"));b.zoomLock=1;b.scrollingLock=!1;b.changeBgSize=!1;b.currentZoomLevel=b.options.zoomLevel; -b.nzOffset=b.$elem.offset();b.widthRatio=b.largeWidth/b.currentZoomLevel/b.nzWidth;b.heightRatio=b.largeHeight/b.currentZoomLevel/b.nzHeight;"window"==b.options.zoomType&&(b.zoomWindowStyle="overflow: hidden;background-position: 0px 0px;text-align:center;background-color: "+String(b.options.zoomWindowBgColour)+";width: "+String(b.options.zoomWindowWidth)+"px;height: "+String(b.options.zoomWindowHeight)+"px;float: left;background-size: "+b.largeWidth/b.currentZoomLevel+"px "+b.largeHeight/b.currentZoomLevel+ -"px;display: none;z-index:100px;border: "+String(b.options.borderSize)+"px solid "+b.options.borderColour+";background-repeat: no-repeat;position: absolute;");"inner"==b.options.zoomType&&(b.zoomWindowStyle="overflow: hidden;background-position: 0px 0px;width: "+String(b.nzWidth)+"px;height: "+String(b.nzHeight)+"px;float: left;display: none;cursor:"+b.options.cursor+";px solid "+b.options.borderColour+";background-repeat: no-repeat;position: absolute;");"window"==b.options.zoomType&&(lensHeight= -b.nzHeight
');d("body").append(b.zoomContainer);b.options.containLensZoom&&"lens"==b.options.zoomType&&b.zoomContainer.css("overflow","hidden");"inner"!=b.options.zoomType&&(b.zoomLens=d("
 
").appendTo(b.zoomContainer).click(function(){b.$elem.trigger("click")}));b.options.tint&&(b.tintContainer=d("
").addClass("tintContainer"),b.zoomTint=d("
"),b.zoomLens.wrap(b.tintContainer),b.zoomTintcss=b.zoomLens.after(b.zoomTint),b.zoomTintImage=d('').appendTo(b.zoomLens).click(function(){b.$elem.trigger("click")})); -isNaN(b.options.zoomWindowPosition)?b.zoomWindow=d("
 
").appendTo("body").click(function(){b.$elem.trigger("click")}):b.zoomWindow=d("
 
").appendTo(b.zoomContainer).click(function(){b.$elem.trigger("click")});b.zoomWindowContainer=d("
").addClass("zoomWindowContainer").css("width", -b.options.zoomWindowWidth);b.zoomWindow.wrap(b.zoomWindowContainer);"lens"==b.options.zoomType&&b.zoomLens.css({backgroundImage:"url('"+b.imageSrc+"')"});"window"==b.options.zoomType&&b.zoomWindow.css({backgroundImage:"url('"+b.imageSrc+"')"});"inner"==b.options.zoomType&&b.zoomWindow.css({backgroundImage:"url('"+b.imageSrc+"')"});b.$elem.bind("touchmove",function(a){a.preventDefault();b.setPosition(a.originalEvent.touches[0]||a.originalEvent.changedTouches[0])});b.zoomContainer.bind("touchmove", -function(a){"inner"==b.options.zoomType&&b.showHideWindow("show");a.preventDefault();b.setPosition(a.originalEvent.touches[0]||a.originalEvent.changedTouches[0])});b.zoomContainer.bind("touchend",function(a){b.showHideWindow("hide");b.options.showLens&&b.showHideLens("hide");b.options.tint&&b.showHideTint("hide")});b.$elem.bind("touchend",function(a){b.showHideWindow("hide");b.options.showLens&&b.showHideLens("hide");b.options.tint&&b.showHideTint("hide")});b.options.showLens&&(b.zoomLens.bind("touchmove", -function(a){a.preventDefault();b.setPosition(a.originalEvent.touches[0]||a.originalEvent.changedTouches[0])}),b.zoomLens.bind("touchend",function(a){b.showHideWindow("hide");b.options.showLens&&b.showHideLens("hide");b.options.tint&&b.showHideTint("hide")}));b.$elem.bind("mousemove",function(a){!1==b.overWindow&&b.setElements("show");if(b.lastX!==a.clientX||b.lastY!==a.clientY)b.setPosition(a),b.currentLoc=a;b.lastX=a.clientX;b.lastY=a.clientY});b.zoomContainer.bind("mousemove",function(a){!1==b.overWindow&& -b.setElements("show");if(b.lastX!==a.clientX||b.lastY!==a.clientY)b.setPosition(a),b.currentLoc=a;b.lastX=a.clientX;b.lastY=a.clientY});"inner"!=b.options.zoomType&&b.zoomLens.bind("mousemove",function(a){if(b.lastX!==a.clientX||b.lastY!==a.clientY)b.setPosition(a),b.currentLoc=a;b.lastX=a.clientX;b.lastY=a.clientY});b.options.tint&&b.zoomTint.bind("mousemove",function(a){if(b.lastX!==a.clientX||b.lastY!==a.clientY)b.setPosition(a),b.currentLoc=a;b.lastX=a.clientX;b.lastY=a.clientY});"inner"==b.options.zoomType&& -b.zoomWindow.bind("mousemove",function(a){if(b.lastX!==a.clientX||b.lastY!==a.clientY)b.setPosition(a),b.currentLoc=a;b.lastX=a.clientX;b.lastY=a.clientY});b.zoomContainer.add(b.$elem).mouseenter(function(){!1==b.overWindow&&b.setElements("show")}).mouseleave(function(){b.scrollLock||b.setElements("hide")});"inner"!=b.options.zoomType&&b.zoomWindow.mouseenter(function(){b.overWindow=!0;b.setElements("hide")}).mouseleave(function(){b.overWindow=!1});1!=b.options.zoomLevel&&b.changeZoomLevel(b.currentZoomLevel); -b.minZoomLevel=b.options.minZoomLevel?b.options.minZoomLevel:2*b.options.scrollZoomIncrement;b.options.scrollZoom&&b.zoomContainer.add(b.$elem).bind("mousewheel DOMMouseScroll MozMousePixelScroll",function(a){b.scrollLock=!0;clearTimeout(d.data(this,"timer"));d.data(this,"timer",setTimeout(function(){b.scrollLock=!1},250));var c=a.originalEvent.wheelDelta||-1*a.originalEvent.detail;a.stopImmediatePropagation();a.stopPropagation();a.preventDefault();0=b.minZoomLevel&&b.changeZoomLevel(b.currentZoomLevel- -b.options.scrollZoomIncrement):b.options.maxZoomLevel?b.currentZoomLevel<=b.options.maxZoomLevel&&b.changeZoomLevel(parseFloat(b.currentZoomLevel)+b.options.scrollZoomIncrement):b.changeZoomLevel(parseFloat(b.currentZoomLevel)+b.options.scrollZoomIncrement);return!1})},setElements:function(b){"show"==b&&this.isWindowSet&&("inner"==this.options.zoomType&&this.showHideWindow("show"),"window"==this.options.zoomType&&this.showHideWindow("show"),this.options.showLens&&this.showHideLens("show"),this.options.tint&& -this.showHideTint("show"));"hide"==b&&("window"==this.options.zoomType&&this.showHideWindow("hide"),this.options.tint||this.showHideWindow("hide"),this.options.showLens&&this.showHideLens("hide"),this.options.tint&&this.showHideTint("hide"))},setPosition:function(b){this.nzHeight=this.$elem.height();this.nzWidth=this.$elem.width();this.nzOffset=this.$elem.offset();this.options.tint&&(this.zoomTint.css({top:0}),this.zoomTint.css({left:0}));this.options.responsive&&!this.options.scrollZoom&&this.options.showLens&& -(lensHeight=this.nzHeightthis.nzHeight-this.zoomLens.height()/ -2-2*this.options.lensBorderSize,this.Eloppos=this.mouseLeft<0+this.zoomLens.width()/2,this.Eroppos=this.mouseLeft>this.nzWidth-this.zoomLens.width()/2-2*this.options.lensBorderSize);"inner"==this.options.zoomType&&(this.Etoppos=this.mouseTopthis.nzHeight-this.nzHeight/2/this.heightRatio,this.Eloppos=this.mouseLeft<0+this.nzWidth/2/this.widthRatio,this.Eroppos=this.mouseLeft>this.nzWidth-this.nzWidth/2/this.widthRatio-2*this.options.lensBorderSize); -0>=this.mouseLeft||0>this.mouseTop||this.mouseLeft>this.nzWidth||this.mouseTop>this.nzHeight?this.setElements("hide"):(this.options.showLens&&(this.lensLeftPos=String(this.mouseLeft-this.zoomLens.width()/2),this.lensTopPos=String(this.mouseTop-this.zoomLens.height()/2)),this.Etoppos&&(this.lensTopPos=0),this.Eloppos&&(this.tintpos=this.lensLeftPos=this.windowLeftPos=0),"window"==this.options.zoomType&&(this.Eboppos&&(this.lensTopPos=Math.max(this.nzHeight-this.zoomLens.height()-2*this.options.lensBorderSize, -0)),this.Eroppos&&(this.lensLeftPos=this.nzWidth-this.zoomLens.width()-2*this.options.lensBorderSize)),"inner"==this.options.zoomType&&(this.Eboppos&&(this.lensTopPos=Math.max(this.nzHeight-2*this.options.lensBorderSize,0)),this.Eroppos&&(this.lensLeftPos=this.nzWidth-this.nzWidth-2*this.options.lensBorderSize)),"lens"==this.options.zoomType&&(this.windowLeftPos=String(-1*((b.pageX-this.nzOffset.left)*this.widthRatio-this.zoomLens.width()/2)),this.windowTopPos=String(-1*((b.pageY-this.nzOffset.top)* -this.heightRatio-this.zoomLens.height()/2)),this.zoomLens.css({backgroundPosition:this.windowLeftPos+"px "+this.windowTopPos+"px"}),this.changeBgSize&&(this.nzHeight>this.nzWidth?("lens"==this.options.zoomType&&this.zoomLens.css({"background-size":this.largeWidth/this.newvalueheight+"px "+this.largeHeight/this.newvalueheight+"px"}),this.zoomWindow.css({"background-size":this.largeWidth/this.newvalueheight+"px "+this.largeHeight/this.newvalueheight+"px"})):("lens"==this.options.zoomType&&this.zoomLens.css({"background-size":this.largeWidth/ -this.newvaluewidth+"px "+this.largeHeight/this.newvaluewidth+"px"}),this.zoomWindow.css({"background-size":this.largeWidth/this.newvaluewidth+"px "+this.largeHeight/this.newvaluewidth+"px"})),this.changeBgSize=!1),this.setWindowPostition(b)),this.options.tint&&this.setTintPosition(b),"window"==this.options.zoomType&&this.setWindowPostition(b),"inner"==this.options.zoomType&&this.setWindowPostition(b),this.options.showLens&&(this.fullwidth&&"lens"!=this.options.zoomType&&(this.lensLeftPos=0),this.zoomLens.css({left:this.lensLeftPos+ -"px",top:this.lensTopPos+"px"})))},showHideWindow:function(b){"show"!=b||this.isWindowActive||(this.options.zoomWindowFadeIn?this.zoomWindow.stop(!0,!0,!1).fadeIn(this.options.zoomWindowFadeIn):this.zoomWindow.show(),this.isWindowActive=!0);"hide"==b&&this.isWindowActive&&(this.options.zoomWindowFadeOut?this.zoomWindow.stop(!0,!0).fadeOut(this.options.zoomWindowFadeOut):this.zoomWindow.hide(),this.isWindowActive=!1)},showHideLens:function(b){"show"!=b||this.isLensActive||(this.options.lensFadeIn? -this.zoomLens.stop(!0,!0,!1).fadeIn(this.options.lensFadeIn):this.zoomLens.show(),this.isLensActive=!0);"hide"==b&&this.isLensActive&&(this.options.lensFadeOut?this.zoomLens.stop(!0,!0).fadeOut(this.options.lensFadeOut):this.zoomLens.hide(),this.isLensActive=!1)},showHideTint:function(b){"show"!=b||this.isTintActive||(this.options.zoomTintFadeIn?this.zoomTint.css({opacity:this.options.tintOpacity}).animate().stop(!0,!0).fadeIn("slow"):(this.zoomTint.css({opacity:this.options.tintOpacity}).animate(), -this.zoomTint.show()),this.isTintActive=!0);"hide"==b&&this.isTintActive&&(this.options.zoomTintFadeOut?this.zoomTint.stop(!0,!0).fadeOut(this.options.zoomTintFadeOut):this.zoomTint.hide(),this.isTintActive=!1)},setLensPostition:function(b){},setWindowPostition:function(b){var a=this;if(isNaN(a.options.zoomWindowPosition))a.externalContainer=d("#"+a.options.zoomWindowPosition),a.externalContainerWidth=a.externalContainer.width(),a.externalContainerHeight=a.externalContainer.height(),a.externalContainerOffset= -a.externalContainer.offset(),a.windowOffsetTop=a.externalContainerOffset.top,a.windowOffsetLeft=a.externalContainerOffset.left;else switch(a.options.zoomWindowPosition){case 1:a.windowOffsetTop=a.options.zoomWindowOffety;a.windowOffsetLeft=+a.nzWidth;break;case 2:a.options.zoomWindowHeight>a.nzHeight&&(a.windowOffsetTop=-1*(a.options.zoomWindowHeight/2-a.nzHeight/2),a.windowOffsetLeft=a.nzWidth);break;case 3:a.windowOffsetTop=a.nzHeight-a.zoomWindow.height()-2*a.options.borderSize;a.windowOffsetLeft= -a.nzWidth;break;case 4:a.windowOffsetTop=a.nzHeight;a.windowOffsetLeft=a.nzWidth;break;case 5:a.windowOffsetTop=a.nzHeight;a.windowOffsetLeft=a.nzWidth-a.zoomWindow.width()-2*a.options.borderSize;break;case 6:a.options.zoomWindowHeight>a.nzHeight&&(a.windowOffsetTop=a.nzHeight,a.windowOffsetLeft=-1*(a.options.zoomWindowWidth/2-a.nzWidth/2+2*a.options.borderSize));break;case 7:a.windowOffsetTop=a.nzHeight;a.windowOffsetLeft=0;break;case 8:a.windowOffsetTop=a.nzHeight;a.windowOffsetLeft=-1*(a.zoomWindow.width()+ -2*a.options.borderSize);break;case 9:a.windowOffsetTop=a.nzHeight-a.zoomWindow.height()-2*a.options.borderSize;a.windowOffsetLeft=-1*(a.zoomWindow.width()+2*a.options.borderSize);break;case 10:a.options.zoomWindowHeight>a.nzHeight&&(a.windowOffsetTop=-1*(a.options.zoomWindowHeight/2-a.nzHeight/2),a.windowOffsetLeft=-1*(a.zoomWindow.width()+2*a.options.borderSize));break;case 11:a.windowOffsetTop=a.options.zoomWindowOffety;a.windowOffsetLeft=-1*(a.zoomWindow.width()+2*a.options.borderSize);break;case 12:a.windowOffsetTop= --1*(a.zoomWindow.height()+2*a.options.borderSize);a.windowOffsetLeft=-1*(a.zoomWindow.width()+2*a.options.borderSize);break;case 13:a.windowOffsetTop=-1*(a.zoomWindow.height()+2*a.options.borderSize);a.windowOffsetLeft=0;break;case 14:a.options.zoomWindowHeight>a.nzHeight&&(a.windowOffsetTop=-1*(a.zoomWindow.height()+2*a.options.borderSize),a.windowOffsetLeft=-1*(a.options.zoomWindowWidth/2-a.nzWidth/2+2*a.options.borderSize));break;case 15:a.windowOffsetTop=-1*(a.zoomWindow.height()+2*a.options.borderSize); -a.windowOffsetLeft=a.nzWidth-a.zoomWindow.width()-2*a.options.borderSize;break;case 16:a.windowOffsetTop=-1*(a.zoomWindow.height()+2*a.options.borderSize);a.windowOffsetLeft=a.nzWidth;break;default:a.windowOffsetTop=a.options.zoomWindowOffety,a.windowOffsetLeft=a.nzWidth}a.isWindowSet=!0;a.windowOffsetTop+=a.options.zoomWindowOffety;a.windowOffsetLeft+=a.options.zoomWindowOffetx;a.zoomWindow.css({top:a.windowOffsetTop});a.zoomWindow.css({left:a.windowOffsetLeft});"inner"==a.options.zoomType&&(a.zoomWindow.css({top:0}), -a.zoomWindow.css({left:0}));a.windowLeftPos=String(-1*((b.pageX-a.nzOffset.left)*a.widthRatio-a.zoomWindow.width()/2));a.windowTopPos=String(-1*((b.pageY-a.nzOffset.top)*a.heightRatio-a.zoomWindow.height()/2));a.Etoppos&&(a.windowTopPos=0);a.Eloppos&&(a.windowLeftPos=0);a.Eboppos&&(a.windowTopPos=-1*(a.largeHeight/a.currentZoomLevel-a.zoomWindow.height()));a.Eroppos&&(a.windowLeftPos=-1*(a.largeWidth/a.currentZoomLevel-a.zoomWindow.width()));a.fullheight&&(a.windowTopPos=0);a.fullwidth&&(a.windowLeftPos= -0);if("window"==a.options.zoomType||"inner"==a.options.zoomType)1==a.zoomLock&&(1>=a.widthRatio&&(a.windowLeftPos=0),1>=a.heightRatio&&(a.windowTopPos=0)),a.largeHeighta.nzWidth?("lens"==a.options.zoomType&&a.zoomLens.css({"background-size":a.largeWidth/a.newvalueheight+"px "+a.largeHeight/a.newvalueheight+"px"}),a.zoomWindow.css({"background-size":a.largeWidth/a.newvalueheight+"px "+a.largeHeight/a.newvalueheight+"px"})):("lens"!=a.options.zoomType&& -a.zoomLens.css({"background-size":a.largeWidth/a.newvaluewidth+"px "+a.largeHeight/a.newvalueheight+"px"}),a.zoomWindow.css({"background-size":a.largeWidth/a.newvaluewidth+"px "+a.largeHeight/a.newvaluewidth+"px"})),a.changeBgSize=!1),a.zoomWindow.css({backgroundPosition:a.windowLeftPos+"px "+a.windowTopPos+"px"}),a.scrollingLock=!1,a.loop=!1):(a.changeBgSize&&(a.nzHeight>a.nzWidth?("lens"==a.options.zoomType&&a.zoomLens.css({"background-size":a.largeWidth/a.newvalueheight+"px "+a.largeHeight/a.newvalueheight+ -"px"}),a.zoomWindow.css({"background-size":a.largeWidth/a.newvalueheight+"px "+a.largeHeight/a.newvalueheight+"px"})):("lens"!=a.options.zoomType&&a.zoomLens.css({"background-size":a.largeWidth/a.newvaluewidth+"px "+a.largeHeight/a.newvaluewidth+"px"}),a.zoomWindow.css({"background-size":a.largeWidth/a.newvaluewidth+"px "+a.largeHeight/a.newvaluewidth+"px"})),a.changeBgSize=!1),a.zoomWindow.css({backgroundPosition:a.xp+"px "+a.yp+"px"}))},16))):(a.changeBgSize&&(a.nzHeight>a.nzWidth?("lens"==a.options.zoomType&& -a.zoomLens.css({"background-size":a.largeWidth/a.newvalueheight+"px "+a.largeHeight/a.newvalueheight+"px"}),a.zoomWindow.css({"background-size":a.largeWidth/a.newvalueheight+"px "+a.largeHeight/a.newvalueheight+"px"})):("lens"==a.options.zoomType&&a.zoomLens.css({"background-size":a.largeWidth/a.newvaluewidth+"px "+a.largeHeight/a.newvaluewidth+"px"}),a.largeHeight/a.newvaluewidth
'),c.$elem.after(c.spinner));c.options.onImageSwap(c.$elem);e.onload=function(){c.largeWidth=e.width;c.largeHeight=e.height;c.zoomImage=a;c.zoomWindow.css({"background-size":c.largeWidth+"px "+c.largeHeight+"px"});c.swapAction(b,a)};e.src=a},swapAction:function(b,a){var c=this,e=new Image;e.onload=function(){c.nzHeight=e.height;c.nzWidth=e.width;c.options.onImageSwapComplete(c.$elem); -c.doneCallback()};e.src=b;c.currentZoomLevel=c.options.zoomLevel;c.options.maxZoomLevel=!1;"lens"==c.options.zoomType&&c.zoomLens.css({backgroundImage:"url('"+a+"')"});"window"==c.options.zoomType&&c.zoomWindow.css({backgroundImage:"url('"+a+"')"});"inner"==c.options.zoomType&&c.zoomWindow.css({backgroundImage:"url('"+a+"')"});c.currentImage=a;if(c.options.imageCrossfade){var f=c.$elem,g=f.clone();c.$elem.attr("src",b);c.$elem.after(g);g.stop(!0).fadeOut(c.options.imageCrossfade,function(){d(this).remove()}); -f.fadeIn(c.options.imageCrossfade);c.options.tint&&(f=c.zoomTintImage,g=f.clone(),c.zoomTintImage.attr("src",a),c.zoomTintImage.after(g),g.stop(!0).fadeOut(c.options.imageCrossfade,function(){d(this).remove()}),f.fadeIn(c.options.imageCrossfade),c.zoomTint.css({height:c.$elem.height()}))}else c.$elem.attr("src",b),c.options.tint&&(c.zoomTintImage.attr("src",a),c.zoomTintImage.attr("height",c.$elem.height()),c.zoomTintImage.css({height:c.$elem.height()}),c.zoomTint.css({height:c.$elem.height()})); -c.options.constrainType&&("height"==c.options.constrainType&&(c.options.imageCrossfade?(c.zoomWrap.css("height",c.options.constrainSize),c.zoomWrap.css("width","auto")):(c.$elem.css("height",c.options.constrainSize),c.$elem.css("width","auto")),c.zoomTint&&(c.zoomTintImage.css("height",c.options.constrainSize),c.zoomTintImage.css("width","auto"))),"width"==c.options.constrainType&&(c.zoomContainer.css("height","auto"),c.zoomContainer.css("width",c.options.constrainSize),c.options.imageCrossfade?(c.zoomWrap.css("height", -"auto"),c.zoomWrap.css("width",c.options.constrainSize)):(c.$elem.css("height","auto"),c.$elem.css("width",c.options.constrainSize)),c.zoomTint&&(c.tintContainer.css("height","auto"),c.tintContainer.css("width",c.options.constrainSize),c.zoomTintImage.css("height","auto"),c.zoomTintImage.css("width",c.options.constrainSize))))},doneCallback:function(){this.options.loadingIcon&&this.spinner.hide();this.nzOffset=this.$elem.offset();this.nzWidth=this.$elem.width();this.nzHeight=this.$elem.height();this.currentZoomLevel= -this.options.zoomLevel;this.widthRatio=this.largeWidth/this.nzWidth;this.heightRatio=this.largeHeight/this.nzHeight;"window"==this.options.zoomType&&(lensHeight=this.nzHeightmaxheightnewvalue&&(newvalue=maxheightnewvalue),newvalue>maxwidthtnewvalue&&(newvalue=maxwidthtnewvalue),maxheightnewvalue<=newvalue?(this.heightRatio=this.largeHeight/newvalue/this.nzHeight,this.newvalueheight=newvalue>maxheightnewvalue?maxheightnewvalue:newvalue,this.fullheight= -!0):(this.heightRatio=this.largeHeight/newvalue/this.nzHeight,this.newvalueheight=newvalue>maxheightnewvalue?maxheightnewvalue:newvalue,this.fullheight=!1),maxwidthtnewvalue<=newvalue?(this.widthRatio=this.largeWidth/newvalue/this.nzWidth,this.newvaluewidth=newvalue>maxwidthtnewvalue?maxwidthtnewvalue:newvalue,this.fullwidth=!0):(this.widthRatio=this.largeWidth/newvalue/this.nzWidth,this.newvaluewidth=newvalue,this.fullwidth=!1));scrcontinue=!1;"inner"==this.options.zoomType&&(this.nzWidth>this.nzHeight&& -(this.newvaluewidth<=maxwidthtnewvalue?scrcontinue=!0:(scrcontinue=!1,this.fullwidth=this.fullheight=!0)),this.nzHeight>this.nzWidth&&(this.newvaluewidth<=maxwidthtnewvalue?scrcontinue=!0:(scrcontinue=!1,this.fullwidth=this.fullheight=!0)));"inner"!=this.options.zoomType&&(scrcontinue=!0);scrcontinue&&(this.zoomLock=0,this.changeZoom=!0,this.options.zoomWindowHeight/this.heightRatio<=this.nzHeight&&(this.currentZoomLevel=this.newvalueheight,"lens"!=this.options.zoomType&&"inner"!=this.options.zoomType&& -(this.changeBgSize=!0,this.zoomLens.css({height:String(this.options.zoomWindowHeight/this.heightRatio)+"px"})),"lens"==this.options.zoomType||"inner"==this.options.zoomType)&&(this.changeBgSize=!0),this.options.zoomWindowWidth/this.widthRatio<=this.nzWidth&&("inner"!=this.options.zoomType&&this.newvaluewidth>this.newvalueheight&&(this.currentZoomLevel=this.newvaluewidth),"lens"!=this.options.zoomType&&"inner"!=this.options.zoomType&&(this.changeBgSize=!0,this.zoomLens.css({width:String(this.options.zoomWindowWidth/ -this.widthRatio)+"px"})),"lens"==this.options.zoomType||"inner"==this.options.zoomType)&&(this.changeBgSize=!0),"inner"==this.options.zoomType&&(this.changeBgSize=!0,this.nzWidth>this.nzHeight&&(this.currentZoomLevel=this.newvaluewidth),this.nzHeight>this.nzWidth&&(this.currentZoomLevel=this.newvaluewidth)));this.setPosition(this.currentLoc)},closeAll:function(){self.zoomWindow&&self.zoomWindow.hide();self.zoomLens&&self.zoomLens.hide();self.zoomTint&&self.zoomTint.hide()}};d.fn.elevateZoom=function(b){return this.each(function(){var a= -Object.create(k);a.init(b,this);d.data(this,"elevateZoom",a)})};d.fn.elevateZoom.options={zoomActivation:"hover",preloading:1,zoomLevel:1,scrollZoom:!1,scrollZoomIncrement:0.1,minZoomLevel:!1,maxZoomLevel:!1,easing:!1,easingAmount:12,lensSize:200,zoomWindowWidth:400,zoomWindowHeight:400,zoomWindowOffetx:0,zoomWindowOffety:0,zoomWindowPosition:1,zoomWindowBgColour:"#fff",lensFadeIn:!1,lensFadeOut:!1,debug:!1,zoomWindowFadeIn:!1,zoomWindowFadeOut:!1,zoomWindowAlwaysShow:!1,zoomTintFadeIn:!1,zoomTintFadeOut:!1, -borderSize:4,showLens:!0,borderColour:"#888",lensBorderSize:1,lensBorderColour:"#000",lensShape:"square",zoomType:"window",containLensZoom:!1,lensColour:"white",lensOpacity:0.4,lenszoom:!1,tint:!1,tintColour:"#333",tintOpacity:0.4,gallery:!1,galleryActiveClass:"zoomGalleryActive",imageCrossfade:!1,constrainType:!1,constrainSize:!1,loadingIcon:!1,cursor:"default",responsive:!0,onComplete:d.noop,onZoomedImageLoaded:function(){},onImageSwap:d.noop,onImageSwapComplete:d.noop}})(jQuery,window,document); \ No newline at end of file +(function(d){var h={jb:function(b,a){var c=this;c.Jb=a;c.g=d(a);c.M=c.g.data("zoom-image")?c.g.data("zoom-image"):c.g.H("src");c.options=d.extend({},d.Ia.Ga.options,b);c.options.F&&(c.options.Ja="none",c.options.va="1");"inner"==c.options.c&&(c.options.S=!1);c.g.parent().tb("title").tb("alt");c.ka=c.M;c.refresh(1);d("#"+c.options.ba+" a").click(function(a){c.options.ua&&(d("#"+c.options.ba+" a").Sb(c.options.ua),d(this).Ea(c.options.ua));a.preventDefault();d(this).data("zoom-image")?c.Va=d(this).data("zoom-image"): +c.Va=d(this).data("image");c.Ab(d(this).data("image"),c.Va);return!1})},refresh:function(b){var a=this;setTimeout(function(){a.ib(a.M)},b||a.options.refresh)},ib:function(b){var a=this,c=new Image;c.onload=function(){a.h=c.width;a.i=c.height;a.yb();a.eb=a.M};c.src=b},yb:function(){var b=this;b.e=b.g.width();b.b=b.g.height();b.fa=!1;b.da=!1;b.ea=!1;b.ya=!1;b.options.J&&(b.oa=b.g.Ua('
'),b.g.a("position","absolute"));b.Wa=1;b.za=!1; +b.v=!1;b.r=b.options.la;b.s=b.g.offset();b.l=b.h/b.r/b.e;b.p=b.i/b.r/b.b;"window"==b.options.c&&(b.Da="overflow: hidden;background-position: 0px 0px;text-align:center;background-color: "+String(b.options.Eb)+";width: "+String(b.options.q)+"px;height: "+String(b.options.t)+"px;float: left;background-size: "+b.h/b.r+"px "+b.i/b.r+"px;display: none;z-index:100px;border: "+String(b.options.m)+"px solid "+b.options.ra+";background-repeat: no-repeat;position: absolute;");"inner"==b.options.c&&(b.Da="overflow: hidden;background-position: 0px 0px;width: "+ +String(b.e)+"px;height: "+String(b.b)+"px;float: left;display: none;cursor:"+b.options.cursor+";px solid "+b.options.ra+";background-repeat: no-repeat;position: absolute;");"window"==b.options.c&&(lensHeight=b.b
');d("body").append(b.G);b.options.cb&&"lens"==b.options.c&&b.G.a("overflow","hidden");"inner"!=b.options.c&&(b.f=d("
 
").qa(b.G).click(function(){b.g.Ca("click")}));b.options.F&&(b.Ba=d("
").Ea("tintContainer"),b.u=d("
"),b.f.Ua(b.Ba),b.Wb=b.f.pa(b.u),b.A=d('').qa(b.f).click(function(){b.g.Ca("click")}));b.d=isNaN(b.options.na)?d("
 
").qa("body").click(function(){b.g.Ca("click")}):d("
 
").qa(b.G).click(function(){b.g.Ca("click")});b.Fb=d("
").Ea("zoomWindowContainer").a("width",b.options.q);b.d.Ua(b.Fb);"lens"==b.options.c&& +b.f.a({backgroundImage:"url('"+b.M+"')"});"window"==b.options.c&&b.d.a({backgroundImage:"url('"+b.M+"')"});"inner"==b.options.c&&b.d.a({backgroundImage:"url('"+b.M+"')"});b.G.add(b.g).ob(function(){!1==b.ya&&b.ha("show")}).pb(function(){b.Tb||b.ha("hide")});"inner"!=b.options.c&&b.d.ob(function(){b.ya=!0;b.ha("hide")}).pb(function(){b.ya=!1});1!=b.options.la&&b.ab(b.r);b.xa=b.options.xa?b.options.xa:2*b.options.vb;b.options.Pa&&b.G.add(b.g)},ha:function(b){"show"==b&&this.kb&&("inner"==this.options.c&& +this.ia("show"),"window"==this.options.c&&this.ia("show"),this.options.S&&this.Qa("show"),this.options.F&&this.Ra("show"));"hide"==b&&("window"==this.options.c&&this.ia("hide"),this.options.F||this.ia("hide"),this.options.S&&this.Qa("hide"),this.options.F&&this.Ra("hide"))},wb:function(b){this.b=this.g.height();this.e=this.g.width();this.s=this.g.offset();this.options.F&&(this.u.a({top:0}),this.u.a({left:0}));this.options.ub&&!this.options.Pa&&this.options.S&&(lensHeight=this.bthis.b-this.f.height()/2-2*this.options.D,this.X=this.N<0+this.f.width()/2,this.U=this.N>this.e-this.f.width()/2-2*this.options.D);"inner"==this.options.c&&(this.Y=this.Othis.b-this.b/2/this.p,this.X=this.N<0+this.e/2/this.l,this.U=this.N>this.e-this.e/2/this.l-2*this.options.D);0>=this.N||0>this.O||this.N>this.e||this.O>this.b?this.ha("hide"): +(this.options.S&&(this.V=String(this.N-this.f.width()/2),this.ga=String(this.O-this.f.height()/2)),this.Y&&(this.ga=0),this.X&&(this.W=this.V=this.w=0),"window"==this.options.c&&(this.T&&(this.ga=Math.max(this.b-this.f.height()-2*this.options.D,0)),this.U&&(this.V=this.e-this.f.width()-2*this.options.D)),"inner"==this.options.c&&(this.T&&(this.ga=Math.max(this.b-2*this.options.D,0)),this.U&&(this.V=this.e-this.e-2*this.options.D)),"lens"==this.options.c&&(this.w=String(-1*((b.pageX-this.s.left)*this.l- +this.f.width()/2)),this.B=String(-1*((b.pageY-this.s.top)*this.p-this.f.height()/2)),this.f.a({backgroundPosition:this.w+"px "+this.B+"px"}),this.v&&(this.b>this.e?("lens"==this.options.c&&this.f.a({"background-size":this.h/this.k+"px "+this.i/this.k+"px"}),this.d.a({"background-size":this.h/this.k+"px "+this.i/this.k+"px"})):("lens"==this.options.c&&this.f.a({"background-size":this.h/this.j+"px "+this.i/this.j+"px"}),this.d.a({"background-size":this.h/this.j+"px "+this.i/this.j+"px"})),this.v=!1), +this.Aa(b)),this.options.F&&this.xb(b),"window"==this.options.c&&this.Aa(b),"inner"==this.options.c&&this.Aa(b),this.options.S&&(this.C&&"lens"!=this.options.c&&(this.V=0),this.f.a({left:this.V+"px",top:this.ga+"px"})))},ia:function(b){"show"!=b||this.fa||(this.options.Ya?this.d.stop(!0,!0,!1).$(this.options.Ya):this.d.show(),this.fa=!0);"hide"==b&&this.fa&&(this.options.Za?this.d.stop(!0,!0).aa(this.options.Za):this.d.R(),this.fa=!1)},Qa:function(b){"show"!=b||this.da||(this.options.Ka?this.f.stop(!0, +!0,!1).$(this.options.Ka):this.f.show(),this.da=!0);"hide"==b&&this.da&&(this.options.La?this.f.stop(!0,!0).aa(this.options.La):this.f.R(),this.da=!1)},Ra:function(b){"show"!=b||this.ea||(this.options.Db?this.u.a({opacity:this.options.Ta}).$a().stop(!0,!0).$("slow"):(this.u.a({opacity:this.options.Ta}).$a(),this.u.show()),this.ea=!0);"hide"==b&&this.ea&&(this.options.Xa?this.u.stop(!0,!0).aa(this.options.Xa):this.u.R(),this.ea=!1)},Ub:function(){},Aa:function(b){var a=this;if(isNaN(a.options.na))a.ta= +d("#"+a.options.na),a.Lb=a.ta.width(),a.Kb=a.ta.height(),a.Ha=a.ta.offset(),a.o=a.Ha.top,a.n=a.Ha.left;else switch(a.options.na){case 1:a.o=a.options.ma;a.n=+a.e;break;case 2:a.options.t>a.b&&(a.o=-1*(a.options.t/2-a.b/2),a.n=a.e);break;case 3:a.o=a.b-a.d.height()-2*a.options.m;a.n=a.e;break;case 4:a.o=a.b;a.n=a.e;break;case 5:a.o=a.b;a.n=a.e-a.d.width()-2*a.options.m;break;case 6:a.options.t>a.b&&(a.o=a.b,a.n=-1*(a.options.q/2-a.e/2+2*a.options.m));break;case 7:a.o=a.b;a.n=0;break;case 8:a.o=a.b; +a.n=-1*(a.d.width()+2*a.options.m);break;case 9:a.o=a.b-a.d.height()-2*a.options.m;a.n=-1*(a.d.width()+2*a.options.m);break;case 10:a.options.t>a.b&&(a.o=-1*(a.options.t/2-a.b/2),a.n=-1*(a.d.width()+2*a.options.m));break;case 11:a.o=a.options.ma;a.n=-1*(a.d.width()+2*a.options.m);break;case 12:a.o=-1*(a.d.height()+2*a.options.m);a.n=-1*(a.d.width()+2*a.options.m);break;case 13:a.o=-1*(a.d.height()+2*a.options.m);a.n=0;break;case 14:a.options.t>a.b&&(a.o=-1*(a.d.height()+2*a.options.m),a.n=-1*(a.options.q/ +2-a.e/2+2*a.options.m));break;case 15:a.o=-1*(a.d.height()+2*a.options.m);a.n=a.e-a.d.width()-2*a.options.m;break;case 16:a.o=-1*(a.d.height()+2*a.options.m);a.n=a.e;break;default:a.o=a.options.ma,a.n=a.e}a.kb=!0;a.o+=a.options.ma;a.n+=a.options.Gb;a.d.a({top:a.o});a.d.a({left:a.n});"inner"==a.options.c&&(a.d.a({top:0}),a.d.a({left:0}));a.w=String(-1*((b.pageX-a.s.left)*a.l-a.d.width()/2));a.B=String(-1*((b.pageY-a.s.top)*a.p-a.d.height()/2));a.Y&&(a.B=0);a.X&&(a.w=0);a.T&&(a.B=a.options.Z?-1*(a.i- +a.d.height()):-1*(a.i/a.r-a.d.height()));a.U&&(a.w=a.options.Z?-1*(a.h-a.d.width()):-1*(a.h/a.r-a.d.width()));a.L&&(a.B=0);a.C&&(a.w=0);if("window"==a.options.c||"inner"==a.options.c)1==a.Wa&&(1>=a.l&&(a.w=0),1>=a.p&&(a.B=0)),a.ia.e?("lens"==a.options.c&&a.f.a({"background-size":a.h/a.k+"px "+a.i/a.k+"px"}),a.d.a({"background-size":a.h/a.k+"px "+a.i/a.k+"px"})):("lens"!=a.options.c&&a.f.a({"background-size":a.h/a.j+"px "+a.i/a.k+"px"}),a.d.a({"background-size":a.h/a.j+"px "+a.i/a.j+"px"})),a.v=!1),a.d.a({backgroundPosition:a.w+"px "+a.B+"px"}),a.za=!1,a.loop=!1):(a.v&&(a.b>a.e?("lens"==a.options.c&&a.f.a({"background-size":a.h/a.k+"px "+a.i/a.k+"px"}),a.d.a({"background-size":a.h/ +a.k+"px "+a.i/a.k+"px"})):("lens"!=a.options.c&&a.f.a({"background-size":a.h/a.j+"px "+a.i/a.j+"px"}),a.d.a({"background-size":a.h/a.j+"px "+a.i/a.j+"px"})),a.v=!1),a.d.a({backgroundPosition:a.P+"px "+a.Q+"px"}))},16))):(a.v&&(a.b>a.e?("lens"==a.options.c&&a.f.a({"background-size":a.h/a.k+"px "+a.i/a.k+"px"}),a.d.a({"background-size":a.h/a.k+"px "+a.i/a.k+"px"})):("lens"==a.options.c&&a.f.a({"background-size":a.h/a.j+"px "+a.i/a.j+"px"}),a.i/a.j
'),c.g.pa(c.Sa));c.options.rb(c.g);e.onload=function(){c.h=e.width/c.r;c.i=e.height/c.r;c.ka=a;c.d.a({"background-size":c.h+"px "+c.i+"px"});c.zb(b,a);c.options.Z=!0};e.src=a},zb:function(b,a){var c=this,e=new Image;e.onload= +function(){c.b=e.height;c.e=e.width;c.options.sb(c.g);c.fb()};e.src=b;c.r=c.options.la;c.options.nb=!1;"lens"==c.options.c&&c.f.a({backgroundImage:"url('"+a+"')"});"window"==c.options.c&&c.d.a({backgroundImage:"url('"+a+"')"});"inner"==c.options.c&&c.d.a({backgroundImage:"url('"+a+"')"});c.eb=a;if(c.options.J){var f=c.g,g=f.bb();c.g.H("src",b);c.g.pa(g);g.stop(!0).aa(c.options.J,function(){d(this).remove()});f.$(c.options.J);c.options.F&&(f=c.A,g=f.bb(),c.A.H("src",a),c.A.pa(g),g.stop(!0).aa(c.options.J, +function(){d(this).remove()}),f.$(c.options.J),c.u.a({height:c.g.height()}))}else c.g.H("src",b),c.options.F&&(c.A.H("src",a),c.A.H("height",c.g.height()),c.A.a({height:c.g.height()}),c.u.a({height:c.g.height()}));c.options.sa&&("height"==c.options.sa&&(c.options.J?(c.oa.a("height",c.options.I),c.oa.a("width","auto")):(c.g.a("height",c.options.I),c.g.a("width","auto")),c.u&&(c.A.a("height",c.options.I),c.A.a("width","auto"))),"width"==c.options.sa&&(c.G.a("height","auto"),c.G.a("width",c.options.I), +c.options.J?(c.oa.a("height","auto"),c.oa.a("width",c.options.I)):(c.g.a("height","auto"),c.g.a("width",c.options.I)),c.u&&(c.Ba.a("height","auto"),c.Ba.a("width",c.options.I),c.A.a("height","auto"),c.A.a("width",c.options.I))))},fb:function(){this.options.wa&&this.Sa.R();this.s=this.g.offset();this.e=this.g.width();this.b=this.g.height();this.r=this.options.la;this.l=this.h/this.e;this.p=this.i/this.b;"window"==this.options.c&&(lensHeight=this.bmaxheightnewvalue&&(newvalue=maxheightnewvalue),newvalue>maxwidthtnewvalue&&(newvalue=maxwidthtnewvalue),maxheightnewvalue<= +newvalue?(this.p=this.i/newvalue/this.b,this.k=newvalue>maxheightnewvalue?maxheightnewvalue:newvalue,this.L=!0):(this.p=this.i/newvalue/this.b,this.k=newvalue>maxheightnewvalue?maxheightnewvalue:newvalue,this.L=!1),maxwidthtnewvalue<=newvalue?(this.l=this.h/newvalue/this.e,this.j=newvalue>maxwidthtnewvalue?maxwidthtnewvalue:newvalue,this.C=!0):(this.l=this.h/newvalue/this.e,this.j=newvalue,this.C=!1));scrcontinue=!1;"inner"==this.options.c&&(this.e>this.b&&(this.j<=maxwidthtnewvalue?scrcontinue=!0: +(scrcontinue=!1,this.C=this.L=!0)),this.b>this.e&&(this.j<=maxwidthtnewvalue?scrcontinue=!0:(scrcontinue=!1,this.C=this.L=!0)));"inner"!=this.options.c&&(scrcontinue=!0);scrcontinue&&(this.Wa=0,this.options.t/this.p<=this.b&&(this.r=this.k,"lens"!=this.options.c&&"inner"!=this.options.c&&(this.v=!0,this.f.a({height:String(this.options.t/this.p)+"px"})),"lens"==this.options.c||"inner"==this.options.c)&&(this.v=!0),this.options.q/this.l<=this.e&&("inner"!=this.options.c&&this.j>this.k&&(this.r=this.j), +"lens"!=this.options.c&&"inner"!=this.options.c&&(this.v=!0,this.f.a({width:String(this.options.q/this.l)+"px"})),"lens"==this.options.c||"inner"==this.options.c)&&(this.v=!0),"inner"==this.options.c&&(this.v=!0,this.e>this.b&&(this.r=this.j),this.b>this.e&&(this.r=this.j)));this.wb(this.Ib)},Hb:function(){self.d&&self.d.R();self.f&&self.f.R();self.u&&self.u.R()}};d.Ia.Ga=function(b){return this.gb(function(){var a=Object.create(h);a.jb(b,this);d.data(this,"elevateZoom",a)})};d.Ia.Ga.options={Vb:"hover", +Rb:1,la:1,Pa:!1,vb:0.1,xa:!1,nb:!1,hb:!1,Fa:12,K:200,q:400,t:400,Gb:0,ma:0,na:1,Eb:"#fff",Ka:!1,La:!1,debug:!1,Ya:!1,Za:!1,Xb:!1,Db:!1,Xa:!1,m:4,S:!0,ra:"#888",D:1,lb:"#000",mb:"square",c:"window",cb:!1,Ja:"white",va:0.4,Ob:!1,F:!1,Bb:"#333",Ta:0.4,ba:!1,ua:"zoomGalleryActive",J:!1,sa:!1,I:!1,wa:!1,cursor:"default",ub:!0,Pb:d.Oa,Qb:function(){},rb:d.Oa,sb:d.Oa,Z:!1}})(jQuery,window,document); diff --git a/jquery.elevatezoom.js b/jquery.elevatezoom.js index f09c94d..db61ff8 100644 --- a/jquery.elevatezoom.js +++ b/jquery.elevatezoom.js @@ -569,8 +569,14 @@ if ( typeof Object.create !== 'function' ) { else{ lensWidth = (self.options.zoomWindowWidth/self.widthRatio); } - self.widthRatio = self.largeWidth / self.nzWidth; - self.heightRatio = self.largeHeight / self.nzHeight; + if(self.options.changed){ + self.widthRatio = self.largeWidth / self.nzWidth; + self.heightRatio = self.largeHeight / self.nzHeight; + } + else { + self.widthRatio = self.largeWidth/self.currentZoomLevel / self.nzWidth; + self.heightRatio = self.largeHeight/self.currentZoomLevel / self.nzHeight; + } if(self.options.zoomType != "lens") { self.zoomLens.css({ width: String((self.options.zoomWindowWidth)/self.widthRatio) + 'px', height: String((self.options.zoomWindowHeight)/self.heightRatio) + 'px' }) @@ -913,8 +919,14 @@ if ( typeof Object.create !== 'function' ) { self.windowTopPos = String(((e.pageY - self.nzOffset.top) * self.heightRatio - self.zoomWindow.height() / 2) * (-1)); if(self.Etoppos){self.windowTopPos = 0;} if(self.Eloppos){self.windowLeftPos = 0;} - if(self.Eboppos){self.windowTopPos = (self.largeHeight/self.currentZoomLevel-self.zoomWindow.height())*(-1); } - if(self.Eroppos){self.windowLeftPos = ((self.largeWidth/self.currentZoomLevel-self.zoomWindow.width())*(-1));} + if(self.Eboppos){ + if(self.options.changed){self.windowTopPos = (self.largeHeight-self.zoomWindow.height())*(-1);} + else{self.windowTopPos = (self.largeHeight/self.currentZoomLevel-self.zoomWindow.height())*(-1);} + } + if(self.Eroppos){ + if(self.options.changed){self.windowLeftPos = ((self.largeWidth-self.zoomWindow.width())*(-1));} + else{self.windowLeftPos = ((self.largeWidth/self.currentZoomLevel-self.zoomWindow.width())*(-1));} + } //stops micro movements if(self.fullheight){ @@ -1114,11 +1126,12 @@ if ( typeof Object.create !== 'function' ) { self.options.onImageSwap(self.$elem); newImg.onload = function() { - self.largeWidth = newImg.width; - self.largeHeight = newImg.height; + self.largeWidth = newImg.width/self.currentZoomLevel; + self.largeHeight = newImg.height/self.currentZoomLevel; self.zoomImage = largeimage; self.zoomWindow.css({ "background-size": self.largeWidth + 'px ' + self.largeHeight + 'px' }); self.swapAction(smallimage, largeimage); + self.options.changed = true; return; } newImg.src = largeimage; // this must be done AFTER setting onload @@ -1638,7 +1651,8 @@ if ( typeof Object.create !== 'function' ) { onComplete: $.noop, onZoomedImageLoaded: function() {}, onImageSwap: $.noop, - onImageSwapComplete: $.noop + onImageSwapComplete: $.noop, + changed: false }; -})( jQuery, window, document ); \ No newline at end of file +})( jQuery, window, document );