KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to detect when all images are loaded via a jQuery event? Ideally, there should be a $(document).idle(function() { } or $(document).contentLoaded(function() { } But I can't find such a thing. I thought of attaching an event like this: $(document).ready(function() { var imageTotal = $('img').length; var imageCount = 0; $('img').load(function(){if(++imageCount == imageTotal) doStuff();}); } But will this break if an image fails to load? It's critically important for the method to be called, and at the right time.
Tags (comma-separated)
Save Edits
Cancel