Skip to content

Instantly share code, notes, and snippets.

@baghayi-gist
Created February 18, 2013 21:50
Show Gist options
  • Save baghayi-gist/4981081 to your computer and use it in GitHub Desktop.
Save baghayi-gist/4981081 to your computer and use it in GitHub Desktop.
JavaScript: Image Preloader
function preload() {
while(arguments.length) {
new Image().src = [].shift.call(arguments);
}
}
#usage
#preload('img1.jpg', 'path/to/img2.jpg', 'img3.jpg');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment