Created
February 24, 2014 09:03
-
-
Save richgcook/9184205 to your computer and use it in GitHub Desktop.
Preload (specific) images (good for img src changes)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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