a preloader does not work on IE8 and 7
Hi
i have a gallery that i wanted to add it a preloader untill all the pictures are loaded. it work great on FF, chrome,safari but it does not work on IE: the preloader does appear but refuse to fade out, so the gallery does not show properly.
this is my code:
-
the jquery:
var z = 0;
var inAnimation = false;
var imgLoaded = 0;
$('#pictures').append('<div id="loader"></div>');
$('#pictures img').each(function() {
z++;
$(this).css('z-index', z);
$(new Image()).attr('src', $(this).attr('src')).load(function() {
imgLoaded++;
if(imgLoaded == z) {
$('#loader').fadeOut('slow');
}
});
});
and the css of the loader :
#loader{
position: absolute;
top:0px;
left:0px;
height: 360px;
width: 100%;
background: url(/images/ajax-loader.gif) white no-repeat center center;
z-index : 9999;
}
best regards
ron