Permalink
Browse files

fix leaking variables to global scope

imgPreloader, preloadPrevImage and preloadNextImage leaked to global
scope
  • Loading branch information...
1 parent 3eba280 commit 60b551fbdb0f3c388c835ada30db729f3f37dd02 @glensc glensc committed Aug 8, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 jquery.lightbox.js
View
@@ -195,7 +195,7 @@
};
function doChangeImage() {
- imgPreloader = new Image();
+ var imgPreloader = new Image();
// once image is preloaded, resize image container
imgPreloader.onload = function() {
@@ -246,6 +246,7 @@
};
function preloadNeighborImages() {
+ var preloadPrevImage, preloadNextImage;
if (opts.loopImages && opts.imageArray.length > 1) {
preloadNextImage = new Image();
preloadNextImage.src = opts.imageArray[(opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1][0];
@@ -494,4 +495,4 @@
jsonData: null,
jsonDataParser: null
};
-})(jQuery);
+})(jQuery);

0 comments on commit 60b551f

Please sign in to comment.