Created
January 26, 2012 13:51
-
-
Save moski/1682850 to your computer and use it in GitHub Desktop.
Wait for Images to load + jquery
This file contains hidden or 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
| # blog post: http://blog.moski.me/2012/01/image-load-event-binding.html | |
| # Assuming All the images we want to preload reside in ".images-preload" | |
| imageTotal = $(".images-preload img").length | |
| imageCount = 0 | |
| $(".images-preload img").load( () -> | |
| if(++imageCount == imageTotal) | |
| console.log("Any Callback Function"); | |
| else | |
| console.log("Keep Loading"); | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment