If this is your image preloader:
Code:
function imagePreloader() {
// counter
var i = 0;
// create object
imageObj = new Image();
// set image list
images = new Array();
images[0]="/images/scroller_test_all.jpg"
images[1]="/images/scroller_test_cars.jpg"
images[2]="/images/scroller_test_trucks.jpg"
images[3]="/images/scroller_test_suvs.jpg"
images[4]="/images/scroller_test_vans.jpg"
// start preloading
for(i=0; i<images.length; i++)
{
imageObj.src=images[i];
//this alert proves the images are being preloaded...
//alert(imageObj.src);
}
}
It's not doing anything because as far as I can tell (using FF developer's extension):
imagePreloader()
is never run (unless it is onload in the body tag). Now, if you have some IE only code that calls it that is shielded from FF by an IE specific comment, it might run under IE (or if it is called from the body tag without conflict), but since it uses the same object for all the images without waiting for any of then to signal that they have completed loading, this:
/images/scroller_test_vans.jpg
is the only image that would be preloaded.
This would be a much more effective preloading routine:
Code:
;(function(){
// set image list
var images = new Array();
images[0]="/images/scroller_test_all.jpg"
images[1]="/images/scroller_test_cars.jpg"
images[2]="/images/scroller_test_trucks.jpg"
images[3]="/images/scroller_test_suvs.jpg"
images[4]="/images/scroller_test_vans.jpg"
// start preloading
var loader = new Array();
for(var i = 0; i < images.length; i++){
loader[i] = new Image();
loader[i].src = images[i];
}
})();
It creates a unique image object for each image, and since it is a totally anonymous function, will run automatically without being called.
There could also be other problems.
Bookmarks