Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #7 from cco3/master

1 commit to prevent background-image: none from being preloaded (which causes 404s)
  • Loading branch information...
commit 63c6a5073e82822998a172d347ed74525266ee6d 2 parents 5d33ac4 + 1bb5dca
@bitbonsai authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 facybox.js
View
8 facybox.js
@@ -282,8 +282,10 @@
function preloadImages(){
//TODO preload prev/next ?
$('#facybox').find('.n, .close , .s, .w, .e, .nw, ne, sw, se').each(function() {
- var img = new Image();
- img.src = $(this).css('background-image').replace(/^url\(\"?/, "").replace(/\"?\)$/, "");
+ backgroundImage = $(this).css('background-image');
+ if (backgroundImage === 'none') return;
+ var img = new Image();
+ img.src = backgroundImage.replace(/url\("?(.*?)"?\)/, '$1');
});
// var img = new Image();
// img.src = 'images/loading.gif';
@@ -447,4 +449,4 @@
$(document).trigger('afterClose.facybox');
});
-})(jQuery);
+})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.