Skip to content

Instantly share code, notes, and snippets.

@moski
Created January 26, 2012 13:51
Show Gist options
  • Select an option

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

Select an option

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