Create a gist now

Instantly share code, notes, and snippets.

@davidsword /preloadimages.js Secret
Last active Feb 15, 2017

const preLoadImages = ["image1.jpg","image2.png"];
preLoadImages.forEach(function(image, index){
setTimeout(function(){
$("<img />").attr("src", image);
}, 1000*index); // every second load 1
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment