Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Easy jquery/zepto images preload
var images = ["path/to/image", "path/to/image", ... , "path/to/image"],
preloaded = images.length;
_.each(images, function(img) {
var image = $('<img />').attr('src', img);
image.on('load', function(){
if (preloaded === 0){
console.log("All preloaded!");
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.