Forum Moderators: open
I'm interested in using fade-in/out effects in Mozilla, and wrote the following with the intention that one click would start an image fading into view, reaching normal MozOpacity (1.0).
But all that happens is that one click just increases the opacity by 0.01, rather than starting the desired fade-in sequence.
<script>
<!--
function transopac(imageobject, opacamt)
{
if (window.sidebar)
{
opacval=parseFloat(document.getElementById(imageobject).style.MozOpacity); // part of previous line
if (opacval <= parseFloat(opacamt-0.01))
{
{
window.status="-moz-opacity: " + opacval;
opacval+=0.01;
document.getElementById(imageobject).style.MozOpacity=""+opacval;
}
}
setTimeout("transopac("+imageobject+","+opacamt+")",50)
}
}
// -->
</script>
<img id="limage" src="rotunda75.jpg" alt="picture" style="-moz-opacity:0.1"> <br />
<a href="javascript:transopac('limage', 1)" >fade-in</a>
Does anyone know what I'm doing wrong?
Thanks for looking.
function FadeIn(el)
{
if(ie)
{
if (el.filters.alpha.opacity < 100)
{
el.filters.alpha.opacity=el.filters.alpha.opacity+15;
setTimeout("FadeIn(document.getElementById('"+el.id+"')",40);
return;
}
}
--------if(ns6¦¦ns7)---------------------------------------
{
if (el.style.MozOpacity < 1)
{
el.style.MozOpacity=el.style.MozOpacity+0.2;
setTimeout("FadeIn(document.getElementById('"+el.id+"')",40);
return;
}
}
------------------------------------------------------------
if(saf)
{
if (el.style.KhtmlOpacity < 1)
{
el.style.KhtmlOpacity=el.style.KhtmlOpacity+0.2;
setTimeout("FadeIn(document.getElementById('"+el.id+"')",40);
return;
}
}
}