Yes. That invites disorder though. If your images are large in byte size, that might be preferable to having to wait for them all.
Most browsers will download 3 images synchronously. So you generally won't notice much of a difference unless they are competing with other page resources or they are of greatly differing bytes size, in which case things could look a bit disorderly.
Images for the web should be optimized for smallest byte size. If your images are, as I say - there shouldn't be much of a difference.
Here's the modified script (essentially the same with a stripped out section and one less variable):
Code:
document.write('\n<style>\n#divContent ul li {\n\tdisplay: none;\n}\n</style>\n');
jQuery(function($){
var oBox = $('#divContent'), aKids = oBox.find('li'), fadeRate = 1000, inc = 1000;
aKids.each(function(){
var img = new Image(), li = $(this);
$(img).load(function(){
li.fadeIn(fadeRate += inc);
}).attr('src', li.find('img').first().attr('src'));
});
});
Note: I condensed the document.write() style to a one liner. But it's the same as before.
Here's an even more condensed version:
Code:
document.write('\n<style>\n#divContent ul li {\n\tdisplay: none;\n}\n</style>\n');
jQuery(function($){
var fadeRate = 1000, inc = 1000;
$('#divContent li').each(function(){
var li = $(this);
$(new Image()).load(function(){
li.fadeIn(fadeRate += inc);
}).attr('src', li.find('img').attr('src'));
});
});
Bookmarks