Fade-funktion fader ikke ud!
På min side benytter jeg en fade-funktion i menuen, som virker helt perfekt i Internet Explorer, men i Firefox fader farven ikke ud igen, men bliver der permanent. Scriptet har jeg ikke selv skrevet, så jeg håber på nogen kan hjælpe. Se på www.snigeren.dk hvordan det virker. Her er koden:/* rev $ID: 2003-05-30T03:14:01 CEST tul $ */
var menuFadeListInGreen = new Array();
var menuFadingInGreen = false;
var menuFadeListOutGreen = new Array();
var menuFadingOutGreen = false;
function menuCleanGreen(obj) {
var tmp;
var newFadeListGreen = new Array();
while(tmp = menuFadeListInGreen.pop())
if(obj != tmp)
newFadeListGreen.push(tmp);
menuFadeListInGreen = newFadeListGreen;
newFadeListGreen = new Array();
while(tmp = menuFadeListOutGreen.pop())
if(obj != tmp)
newFadeListGreen.push(tmp);
menuFadeListOutGreen = newFadeListGreen;
}
function fadeInGreen(obj) {
menuCleanGreen(obj);
obj.style.cursor = 'hand';
obj.style.color = 'white';
obj.style.backgroundColor = '#0c802f';
menuFadeListInGreen.push(obj);
if(!menuFadingInGreen)
menuFadeInGreen();
}
function fadeOutGreen(obj) {
menuCleanGreen(obj);
// obj.style.backgroundColor = '#0c802f';
menuFadeListOutGreen.push(obj);
if(!menuFadingOutGreen)
menuFadeOutGreen();
}
function menuFadeOutGreen() {
var newFadeListOutGreen = new Array();
var obj;
while(obj = menuFadeListOutGreen.pop()) {
newFadeListOutGreen.push(obj);
switch(obj.style.backgroundColor) {
case '#0c802f':
obj.style.backgroundColor = '#0e9638';
obj.style.color = 'black';
break;
case '#0e9638':
obj.style.backgroundColor = '#0eb240';
obj.style.color = 'black';
break;
case '#0eb240':
obj.style.backgroundColor = '#19cd50';
obj.style.color = 'black';
break;
case '#19cd50':
obj.style.backgroundColor = '#32dc66';
obj.style.color = 'black';
break;
case '#32dc66':
obj.style.backgroundColor = '#ffff99';
obj.style.color = 'black';
break;
default:
newFadeListOutGreen.pop();
}
}
menuFadeListOutGreen = newFadeListOutGreen;
if(menuFadeListOutGreen.length) {
setTimeout('menuFadeOutGreen()', 20);
menuFadingOutGreen = true;
}
else
menuFadingOutGreen = false;
}
function menuFadeInGreen() {
var newFadeListInGreen = new Array();
var obj;
while(obj = menuFadeListInGreen.pop()) {
newFadeListInGreen.push(obj);
switch(obj.style.backgroundColor) {
case '#c2d2c2':
obj.style.backgroundColor = '#b2c2b2';
obj.style.color = 'black';
break;
case '#b2c2b2':
obj.style.backgroundColor = '#a2b2a2';
obj.style.color = 'white';
break;
case '#a2b2a2':
obj.style.backgroundColor = '#a2ffcc';
obj.style.color = 'white';
break;
case '#a2ffcc':
obj.style.backgroundColor = '#6bff9b';
obj.style.color = 'white';
break;
case '#6bff9b':
obj.style.backgroundColor = '#90ff5a';
obj.style.color = 'white';
break;
default:
newFadeListInGreen.pop();
}
}
menuFadeListInGreen = newFadeListInGreen;
if(menuFadeListInGreen.length) {
setTimeout('menuFadeInGreen()', 20);
menuFadingInGreen = true;
}
else
menuFadingInGreen = false;
}