You donβt know how you dynamically add your content, but this example should show how it can work.
Used by .append() to simulate your dynamically loaded content. Then, after adding it, it uses .find() to search for images and .load() to attach a load handler to them.
Finally, it returns the length property of the images. Then, in the load handler, when image loading ends, the length decreases. As soon as it reaches 0 , all images will be loaded, and the code inside if() will be launched.
Example: http://jsfiddle.net/ehwyF/
var len = $('#mydiv').append('<img src = "http://dummyimage.com/150x90/f00/fff.png&text=my+image" /><img src = "http://dummyimage.com/160x90/f00/fff.png&text=my+image" /><img src = "http://dummyimage.com/170x90/f00/fff.png&text=my+image" /><img src = "http://dummyimage.com/180x90/f00/fff.png&text=my+image" />') .find('img') .load(function() { if( --len === 0) { alert('all are loaded'); } }).length;
Thus, the code only works on images in #mydiv .
If there are any images there that were not dynamic, and therefore should not receive the .load() event, you should be able to add a .not() filter to exclude those complete true properties.
Put this after .find() and before .load() .
.not(function(){return this.complete})
user113716
source share