Skip to content

Commit

Permalink
Merge pull request #7 from cco3/master
Browse files Browse the repository at this point in the history
1 commit to prevent background-image: none from being preloaded (which causes 404s)
  • Loading branch information
bitbonsai committed Sep 4, 2011
2 parents 5d33ac4 + 1bb5dca commit 63c6a50
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions facybox.js
Expand Up @@ -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';
Expand Down Expand Up @@ -447,4 +449,4 @@
$(document).trigger('afterClose.facybox');
});

})(jQuery);
})(jQuery);

0 comments on commit 63c6a50

Please sign in to comment.