je************@yahoo.se a écrit :
I want the image to disapear from bottom and up very smooth, maybe
under 3-4sec.
Is it possible ? any tips ?
Example :
<html>
<script type="text/javascript">
function $(id) { return (typeof(id)=='string')?
document.getElementById(id) : id; }
function fadder(what, opacity, sens, duration)
{
what = $(what);
opacity = (opacity == 100)? 99.999 : opacity;
// IE/Win
what.style.filter = "alpha(opacity:"+opacity+")";
// Safari<1.2, Konqueror
what.style.KHTMLOpacity = opacity/100;
// Older Mozilla and Firefox
what.style.MozOpacity = opacity/100;
// Safari 1.2, newer Firefox and Mozilla, CSS3
what.style.opacity = opacity/100
if(sens>0 && opacity<99 || sens<0 && opacity>0)
{
opacity += 1*sens;
setTimeout(
function(){fadder(what, opacity, sens, duration);}
,duration);
}
else
{
$('show').style.display=$('show').style.display==' '?'none':'';
$('hid').style.display=$('hid').style.display==''? 'none':'';
}
}
</script>
In onclick of button play with duration : here = 150<br>
<img src="asm1.gif" alt="" id="pict" />
<button id="show"
onclick="fadder('pict', 1, 1, 150);"
style="display:none">show</button>
<button id="hid"
onclick="fadder('pict', 98, -1, 150);">hide</button>
</html>
--
Stephane Moriaux et son moins vieux Mac déjà dépassé
Stephane Moriaux and his less old Mac already out of date