Skip to content

Instantly share code, notes, and snippets.

@richgcook
Created February 24, 2014 09:03
Show Gist options
  • Save richgcook/9184205 to your computer and use it in GitHub Desktop.
Save richgcook/9184205 to your computer and use it in GitHub Desktop.
Preload (specific) images (good for img src changes)
function preloadImages(arrayOfImages) {
$(arrayOfImages).each(function(){
$('<img/>')[0].src = this;
});
}
// Usage
preloadImages([
'img/1.jpg',
'img/2.jpg',
'img/3.jpg'
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment