Skip to content

Instantly share code, notes, and snippets.

@Vyygir Vyygir/preload.js
Last active Apr 12, 2016

Embed
What would you like to do?
Relatively simple image preloader
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
You can’t perform that action at this time.