Created
September 28, 2013 14:41
-
-
Save name-k/6742754 to your computer and use it in GitHub Desktop.
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() { | |
// To keep track of how many images have loaded | |
var loaded = 0; | |
// Let's retrieve how many images there are | |
var numImages = $("img").length; | |
// Let's bind a function to the loading of EACH image | |
$("img").load(function() { | |
// One more image has loaded | |
++loaded; | |
// Only if ALL the images have loaded | |
if (loaded === numImages) { | |
// This will be executed ONCE after all images are loaded. | |
// YOUR CODE GOES HERE function() { ... } | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment