05. april 2005 - 22:58
Der er
5 kommentarer og 1 løsning
Tekst og link fader problemer
Jeg har nogle problemer med dette script: I firefox virker min mouseover og mouseout kun første gang.. :-( Og i IE virker fadningen slet ikke... :-(( ------------------------------------------------- <html> <head> <title>Fade ind og ud</title> <script type="text/javascript"> opac = 0; function fadeind(id) { if (opac <= 80) { if(document.getElementById("mintxt"+id)) { obj = document.getElementById("mintxt"+id); if (document.all) { obj.filters.alpha.opacity = opac; } else { obj.style.MozOpacity = opac / 100; } opac += 5; setTimeout("fadeind("+id+");", 20); } } else { id += 1; opac = 0; setTimeout("fadeind("+id+");", 10); } } op = 80; function over(id) { if (op >= 40) { if (document.all) { for(x=0;x<5;x++) { if(x != id) { obj.filters.alpha.opacity = opl; } else { obj.filters.alpha.opacity = 100; } } } else { for(x=0;x<5;x++) { if(x != id) { document.getElementById("mintxt"+x).style.MozOpacity = op / 100; } else { document.getElementById("mintxt"+x).style.MozOpacity = 1; } } } op -= 5; setTimeout("over("+id+");", 20); } } opl = 40; function out(id) { if (opl <= 80) { if (document.all) { for(x=0;x<5;x++) { if(x != id) { obj.filters.alpha.opacity = opl; } else { obj.filters.alpha.opacity = 80; } } } else { for(x=0;x<5;x++) { if(x != id) { document.getElementById("mintxt"+x).style.MozOpacity = opl / 100; } else { document.getElementById("mintxt"+x).style.MozOpacity = 0.8; } } } opl += 5; setTimeout("out("+id+");", 20); } } </script> <style type="text/css"> body {background-color: #000000;} .link {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-style: normal; font-weight: bold; color: #FFFFFF; line-height: 120%;text-decoration: none;filter:alpha(opacity=0);-moz-opacity:0;} .link a{font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-style: normal; font-weight: bold; color: #FFFFFF; line-height: 120%;text-decoration: none;filter:alpha(opacity=50);-moz-opacity:0;} .link a:hover{font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-style: normal; font-weight: bold; color: #666666; line-height: 120%;text-decoration: underline;filter:alpha(opacity=0);-moz-opacity:0;} </style></head> <body onload="fadeind(0);"> <table width="500" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="119" height="25"><div align="left"><a href="fade.php" id="mintxt0" class="link" onMouseOver="over(0);" onMouseOut="out(0);">Fading1</a></div></td> <td width="119" height="25"><div align="left"><a href="fade.php" id="mintxt1" class="link" onMouseOver="over(1);" onMouseOut="out(1);">Fading2</a></div></td> <td width="119" height="25"><div align="left"><a href="fade.php" id="mintxt2" class="link" onMouseOver="over(2);" onMouseOut="out(2);">Fading3</a></div></td> <td width="119" height="25"><div align="left"><a href="fade.php" id="mintxt3" class="link" onMouseOver="over(3);" onMouseOut="out(3);">Fading4</a></div></td> <td width="119" height="25"><div align="left"><a href="fade.php" id="mintxt4" class="link" onMouseOver="over(4);" onMouseOut="out(4);">Fading5</a></div></td> </tr> </table> </body> </html>
Annonceindlæg fra Barco
06. april 2005 - 01:30
#1
Selvfølgelig virker faden ikke i IE, når timeouts kun initialiseres, hvis det er en ikke-IE-browser ...
06. april 2005 - 08:59
#2
jeg er ikke helt med...? Jeg sad og prøvede noget, og fik det til at virke nogenlunde, båe i IE og firefox, men det krævede at jeg fjernede selve <a href...... > og lagde en onclick i <div> tagget, men så får jeg ikke curseren "hånd" i firefox. Jeg har også et andet problem, hvis jeg kører musen over alle linksne hurtigt, får jeg bare nogle links som står og blinker...? ----------------------------------------------- <html> <head> <title>Fade ind og ud</title> <script type="text/javascript"> opac = 0; function fadeind(id) { if (opac <= 80) { if(document.getElementById("mintxt"+id)) { obj = document.getElementById("mintxt"+id); if (document.all) { obj.filters.alpha.opacity = opac; } else { obj.style.MozOpacity = opac / 100; } opac += 5; setTimeout("fadeind("+id+");", 20); } } else { id += 1; opac = 0; setTimeout("fadeind("+id+");", 10); } } op = 80; function over(id) { //alert(id); if (op >= 40) { if (document.all) { for(x=0;x<5;x++) { if(x != id) { document.getElementById("mintxt"+x).filters.alpha.opacity = op; } else { document.getElementById("mintxt"+x).filters.alpha.opacity = 100; } } } else { for(x=0;x<5;x++) { if(x != id) { document.getElementById("mintxt"+x).style.MozOpacity = op / 100; } else { document.getElementById("mintxt"+x).style.MozOpacity = 1; } } } op -= 5; setTimeout("over("+id+");", 20); } opl = 40; } opl = 40; function out(id) { if (opl <= 80) { if (document.all) { for(x=0;x<5;x++) { if(x != id) { document.getElementById("mintxt"+x).filters.alpha.opacity = opl; } else { document.getElementById("mintxt"+x).filters.alpha.opacity = 80; } } } else { for(x=0;x<5;x++) { if(x != id) { document.getElementById("mintxt"+x).style.MozOpacity = opl / 100; } else { document.getElementById("mintxt"+x).style.MozOpacity = 0.8; } } } opl += 5; setTimeout("out("+id+");", 20); } op = 80; } </script> <style type="text/css"> body {background-color: #000000;} </style></head> <body onload="fadeind(0);"> <table width="500" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="119" height="25" id="mintxt0" style="cursor:hand;filter:alpha(opacity=0);-moz-opacity:0;"><div style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-style: normal; font-weight: bold; color: #FFFFFF; line-height: 120%;text-decoration: none;text-align:left;" onClick="document.location.href='fade.php'" onMouseOver="over(0);" onMouseOut="out(0);">Fading1</div></td> <td width="119" height="25" id="mintxt1" style="filter:alpha(opacity=0);-moz-opacity:0;"><div style="cursor:hand;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-style: normal; font-weight: bold; color: #FFFFFF; line-height: 120%;text-decoration: none;text-align:left;" onClick="document.location.href='fade.php'" onMouseOver="over(1);" onMouseOut="out(1);">Fading2</div></td> <td width="119" height="25" id="mintxt2" style="filter:alpha(opacity=0);-moz-opacity:0;"><div style="cursor:hand;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-style: normal; font-weight: bold; color: #FFFFFF; line-height: 120%;text-decoration: none;text-align:left;" onClick="document.location.href='fade.php'" onMouseOver="over(2);" onMouseOut="out(2);">Fading3</div></td> <td width="119" height="25" id="mintxt3" style="filter:alpha(opacity=0);-moz-opacity:0;"><div style="cursor:hand;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-style: normal; font-weight: bold; color: #FFFFFF; line-height: 120%;text-decoration: none;text-align:left;" onClick="document.location.href='fade.php'" onMouseOver="over(3);" onMouseOut="out(3);">Fading4</div></td> <td width="119" height="25" id="mintxt4" style="filter:alpha(opacity=0);-moz-opacity:0;"><div style="cursor:hand;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-style: normal; font-weight: bold; color: #FFFFFF; line-height: 120%;text-decoration: none;text-align:left;" onClick="document.location.href='fade.php'" onMouseOver="over(4);" onMouseOut="out(4);">Fading5</div></td> </tr> </table> </body> </html>
06. april 2005 - 09:20
#3
I css-standarden hedder hånd-cursoren pointer, M$ var bare først til at indføre muligheden for at style cursor, men sidst til at indføre standarden, så sæt cursor:pointer; ind i stedet, og bagved hand-tingen, hvis du også vil understøtte IE4 og 5 !-)
27. oktober 2007 - 01:42
#4
Nu er jeg begyndt at programmere igen, også tænkte jeg, at jeg lige ville ryde lidt op i mine uafsluttede sager herinde! Så hvis du vil have noget kredit, så læg et svar Mvh Mekaniker
30. oktober 2007 - 02:26
#5
Oki '-)
01. november 2007 - 16:22
#6
-- og tak for point ;~}
Vi tilbyder markedets bedste kurser inden for webudvikling