Skip to content

Instantly share code, notes, and snippets.

@moski
Created January 26, 2012 14:09
Show Gist options
  • Select an option

  • Save moski/1682921 to your computer and use it in GitHub Desktop.

Select an option

Save moski/1682921 to your computer and use it in GitHub Desktop.
Wait for Images to load + jquery + IE Fix
#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