pelegk1
08-26-2003, 12:46 AM
i have a div with img and some text
i want to make it like go and fade away
when presing on it
how do i do it?
10X:)
peleg
i want to make it like go and fade away
when presing on it
how do i do it?
10X:)
peleg
|
Click to See Complete Forum and Search --> : making a div dissapear pelegk1 08-26-2003, 12:46 AM i have a div with img and some text i want to make it like go and fade away when presing on it how do i do it? 10X:) peleg Gollum 08-26-2003, 04:06 AM If it were just text, it would be easy - just set up a timeout loop to slowly change the text colour to the background colour. Doing the same to an image complicates things. The partial transparency in PNG files sounds good except it won't work in IE. If the image is not too big, you could create a GIF animation that fades the image to the background colour at the same rate as the text. pelegk1 08-26-2003, 05:19 AM http://javascript.internet.com/messages/QLib/amazing-message-box.html Gollum 08-26-2003, 06:11 AM Ahh, I was confused when you said "fade" which usually means the image grows dimmer and dimmer until you can't see it any more. I think what you are after is called a "sweep" To do a sweep, you could use 2 divs, one inside the other, the outer one crops the inner one and shrinks while the inner one moves left so that it appears to stay still. You will probably want to change the <img> bit with your message 'n stuff <div id=sweepOuter style="position:absolute; left:100px;top:100px;width:300px;height:200px;overflow:hidden;"> <div id=sweepInner style="position:relative; left:0px"> <img galleryimg=no src="myMessage.gif" onclick="sweepT = 0; sweep();"> </div> </div> <script> var sweepT = 0; function sweep() { var oOuter = document.getElementById('sweepOuter'); var oInner = document.getElementById('sweepInner'); sweepT += 5; if ( sweepT < 150 ) { oOuter.style.left = (100 + sweepT).toString() + "px"; oOuter.style.width = (300 - sweepT * 2).toString() + "px"; oInner.style.left = "-" + sweepT.toString() + "px"; window.setTimeout("sweep();",25); } else { oOuter.style.visibility = "hidden"; } } </script> diamonds 08-26-2003, 10:38 AM How does that fade? with the opacity style. Try looking at the code. pelegk1 08-27-2003, 12:23 AM i tried to do that same but i do something wronng i dont know execlly what webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |