I'm working on a site that is very background-image intensive. Since some of the images are large, the aesthetic appeal of the page will inevitably suffer at the initial load, probably for several seconds.
So I'm trying to make a background-image preloader with jQuery and here's where I'm at:
$(document).ready(function(e){
$('*')
.each(function(){
if($(this).css('background-image') != 'none'){
//so, i can get the path, where do i go from here?
alert($(this).css('background-image').slice(5, -2));
}
});
});
I'm used an array of Image() objects, to load the image using the path pulled from my iterator, but I'm lost on where to go from here.
How can I determine when all of the images in the array have 'loaded', so that I can call a function to fade out a preloader curtain or something?