Skip to content

Commit

Permalink
Merge branch 'Zakay-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Eades committed Jun 28, 2015
2 parents 29cafcd + 30c027f commit f8a8cfe
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions jquery.elevatezoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ if ( typeof Object.create !== 'function' ) {
+ "margin-top: " + String(borderWidth) + ";"
+ "background-position: 0px 0px;"
+ "width: " + String(self.nzWidth) + "px;"
+ "height: " + String(self.nzHeight)
+ "height: " + String(self.nzHeight) + "px;"
+ "px;float: left;"
+ "display: none;"
+ "cursor:"+(self.options.cursor)+";"
Expand Down Expand Up @@ -659,7 +659,7 @@ if ( typeof Object.create !== 'function' ) {
}

// if the mouse position of the slider is one of the outerbounds, then hide window and lens
if (self.mouseLeft <= 0 || self.mouseTop < 0 || self.mouseLeft > self.nzWidth || self.mouseTop > self.nzHeight ) {
if (self.mouseLeft < 0 || self.mouseTop < 0 || self.mouseLeft > self.nzWidth || self.mouseTop > self.nzHeight ) {
self.setElements("hide");
return;
}
Expand Down Expand Up @@ -774,7 +774,13 @@ if ( typeof Object.create !== 'function' ) {
if(change == "hide"){
if(self.isWindowActive){
if(self.options.zoomWindowFadeOut){
self.zoomWindow.stop(true, true).fadeOut(self.options.zoomWindowFadeOut);
self.zoomWindow.stop(true, true).fadeOut(self.options.zoomWindowFadeOut, function () {
if (self.loop) {
//stop moving the zoom window when zoom window is faded out
clearInterval(self.loop);
self.loop = false;
}
});
}
else{self.zoomWindow.hide();}
self.isWindowActive = false;
Expand Down Expand Up @@ -995,13 +1001,15 @@ if ( typeof Object.create !== 'function' ) {
}
// adjust images less than the window height

if(self.largeHeight < self.options.zoomWindowHeight){
if (self.options.zoomType == "window") {
if (self.largeHeight < self.options.zoomWindowHeight) {

self.windowTopPos = 0;
self.windowTopPos = 0;
}
if (self.largeWidth < self.options.zoomWindowWidth) {
self.windowLeftPos = 0;
}
}
if(self.largeWidth < self.options.zoomWindowWidth){
self.windowLeftPos = 0;
}

//set the zoomwindow background position
if (self.options.easing){
Expand Down Expand Up @@ -1071,6 +1079,12 @@ if ( typeof Object.create !== 'function' ) {
self.loop = false;

}
else if (Math.round(Math.abs(self.xp - self.windowLeftPos) + Math.abs(self.yp - self.windowTopPos)) < 1) {
//stops micro movements
clearInterval(self.loop);
self.zoomWindow.css({ backgroundPosition: self.windowLeftPos + 'px ' + self.windowTopPos + 'px' });
self.loop = false;
}
else{
if(self.changeBgSize){
if(self.nzHeight>self.nzWidth){
Expand Down Expand Up @@ -1171,7 +1185,6 @@ if ( typeof Object.create !== 'function' ) {
self.largeHeight = newImg.height;
self.zoomImage = largeimage;
self.zoomWindow.css({ "background-size": self.largeWidth + 'px ' + self.largeHeight + 'px' });
self.zoomWindow.css({ "background-size": self.largeWidth + 'px ' + self.largeHeight + 'px' });


self.swapAction(smallimage, largeimage);
Expand Down Expand Up @@ -1774,4 +1787,4 @@ if ( typeof Object.create !== 'function' ) {
onImageSwapComplete: $.noop
};

})( jQuery, window, document );
})( jQuery, window, document );

0 comments on commit f8a8cfe

Please sign in to comment.