Created
January 26, 2012 14:09
-
-
Save moski/1682921 to your computer and use it in GitHub Desktop.
Wait for Images to load + jquery + IE Fix
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").each( () -> | |
| $(@).attr('src', $(@).attr('src') + '?iemustdie=' + (new Date()).getTime())).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