In jQuery when you do this:
$(function() {
alert(\"DOM is loaded, but images not necessarily all loaded\");
});
It waits for the DOM to
With jQuery i come with this...
$(function() {
var $img = $('img'),
totalImg = $img.length;
var waitImgDone = function() {
totalImg--;
if (!totalImg) alert("Images loaded!");
};
$('img').each(function() {
$(this)
.load(waitImgDone)
.error(waitImgDone);
});
});
Demo : http://jsfiddle.net/molokoloco/NWjDb/