Skip to content

Instantly share code, notes, and snippets.

@stapelberg
Created July 18, 2011 09:06
Show Gist options
  • Save stapelberg/1088965 to your computer and use it in GitHub Desktop.
Save stapelberg/1088965 to your computer and use it in GitHub Desktop.
jquery imagezoom bugfix
--- jquery.imageZoom.js.O 2011-03-15 13:25:54.000000000 +0100
+++ jquery.imageZoom.js 2011-07-18 11:02:12.000000000 +0200
@@ -97,6 +97,7 @@
}
// This function is run once the displayImgSrc-img has loaded (below)
+ var preload = new Image();
var preloadOnload = function () {
// The clicked-link is faded out during loading, fade it back in
clickedLink.setNotLoadingImg();
@@ -114,8 +115,8 @@
};
var imgzoom = jQuery('<div><img src="' + displayImgSrc + '" alt="" /></div>').css('position', 'absolute').appendTo(document.body); // We don't want any class-name or any other contents part from the image when we calculate the new dimensions of the imgzoom
var imgzoomAfter = { // The dimensions of the imgzoom _after_ it is zoomed out
- width: imgzoom.outerWidth(),
- height: imgzoom.outerHeight()/*,
+ width: preload.width,
+ height: preload.height/*,
opacity: 1*/
};
var windowDim = {
@@ -167,7 +168,6 @@
};
// Preload image
- var preload = new Image();
preload.src = displayImgSrc;
if (preload.complete) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment