Skip to content

Instantly share code, notes, and snippets.

@devth
Created June 21, 2010 17:30
Show Gist options
  • Save devth/447184 to your computer and use it in GitHub Desktop.
Save devth/447184 to your computer and use it in GitHub Desktop.
// PRELOADER
var cache = [];
// Arguments are image paths relative to the current page.
$.preLoadImages = function() {
var args_len = arguments.length;
for (var i = args_len; i--;) {
var cacheImage = document.createElement('img');
cacheImage.src = arguments[i];
cache.push(cacheImage);
// $( cacheImage ).bind('load', function(){ console.log('loaded ' + this.src); } );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment