Last active
April 12, 2016 10:59
-
-
Save Vyygir/528872a501e9e09cafba1aa2391aa469 to your computer and use it in GitHub Desktop.
Relatively simple image preloader
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() { | |
var buffer, images; | |
buffer = new Image(); | |
images = document.getElementsByTagName('img'); | |
if (images.length) { | |
for (var i = 0, l = images.length; i < l; i++) { | |
buffer.src = images[i].src; | |
} | |
} | |
} | |
preloadImages(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment