martynball
07-22-2010, 03:00 AM
// Values for fading
var fadeBy = 10; //Amount to fade by
var fadeTime = 120; //Time in milliseconds to fade.
var ie_counter = 0; //Counter for crappy IE.
var fade_to = 70;
function fader(obj) {
var div = document.getElementById(obj);
//Object details
var opacity = div.style.opacity * 100 + fadeBy; //Fade (FF)
ie_counter = ie_counter + fadeBy;
var opacity_ie = div.style.filter = "alpha(opacity=" + ie_counter + ")"; //Fade (IE)
div.style.opacity = opacity / 100;
if ( ie_counter != fade_to || opacity != fade_to ) {
setTimeout( "fader('" + obj + "')", fadeTime );
}
}
The loop stops for firefox (good browser), but not for internet explorer for some reason :/
Apart for the fact that IE is crap why is this?
var fadeBy = 10; //Amount to fade by
var fadeTime = 120; //Time in milliseconds to fade.
var ie_counter = 0; //Counter for crappy IE.
var fade_to = 70;
function fader(obj) {
var div = document.getElementById(obj);
//Object details
var opacity = div.style.opacity * 100 + fadeBy; //Fade (FF)
ie_counter = ie_counter + fadeBy;
var opacity_ie = div.style.filter = "alpha(opacity=" + ie_counter + ")"; //Fade (IE)
div.style.opacity = opacity / 100;
if ( ie_counter != fade_to || opacity != fade_to ) {
setTimeout( "fader('" + obj + "')", fadeTime );
}
}
The loop stops for firefox (good browser), but not for internet explorer for some reason :/
Apart for the fact that IE is crap why is this?