Click to See Complete Forum and Search --> : Making a div fade in and out ---- Impossible???


DJRobThaMan
07-25-2003, 10:50 AM
I think I remember reading somewhere online that it was possible to, instead of simply making an element (for my purposes, a div) in a web page appear or disappear, you can make it fade in and out.


Is this really true?

If it is is it possible to regulate the time it takes to do so and such????



Thanks

DJRobThaMan
07-25-2003, 04:08 PM
Does anybody have any clue????

Lizo
07-25-2003, 04:10 PM
I dont know how to do it but somewhere along the line its going to have a timeout function that controls the alpha value of the div.

xataku_nakusute
07-25-2003, 04:49 PM
<html>
<head>
</head>
<body>
<script type="text/javascript">
function fade()
{
i = 0
while(i<100)
{
document.write("<div style='background: #c0c0c0; filter: alpha\(Opacity="+i+"\)'>Yes</div>");
i++
}
}
</script>
<input type=button onclick="fade()" value="Fade">
</body>
</html>

of course, that will just display them separately but you can try to work off of this

Yogg
07-25-2003, 05:03 PM
<html>
<head>
</head>
<body>
<script type="text/javascript">
function fade()
{
for (i=0;i<100;i++)
{
document.getElementById('div1').style.filter = "alpha(Opacity="+i+")";
}
}
</script>
<div id="div1" style="background: #c0c0c0">yes</div>
<input type=button onclick="fade()" value="Fade">
</body>
</html>

Maybe this.... (i didn't test it...)

xataku_nakusute
07-25-2003, 05:10 PM
nope, that one doesnt work either...

pyro
07-25-2003, 05:23 PM
Play around with the transitions here (http://msdn.microsoft.com/workshop/samples/author/dhtml/DXTidemo/DXTidemo.htm).