PDA

View Full Version : Need help with Image Disappear Script



eyesronthesky
03-08-2009, 09:47 PM
I would SOOO APPRECIATE someone looking at this short script which makes an image disappear after a set amount of seconds, and then advise me as to how it may be modified to FADE away, instead of just snapping into disappearance. If you just open the script into an html doc, you should see the script in action; the image in the script rests in my server directory. Thanks.

<script type="text/javascript">window.setTimeout("document.getElementById('something').style.display='none';", 3000); </script>
<img id="something" src="http://bestartperiod.com/fademe02.jpg" width="400" height="300" border="0" alt="" />

Nile
03-09-2009, 03:00 AM
Try jQuery's fadeOut function (http://docs.jquery.com/Effects/fadeOut#speedcallback).

Like:


<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
var $something = $("#something");
$something
.animate({"color": $something.css("color")}, 100)
.fadeOut("slow");
});
</script>


The animate function I'm using as a delay function.

(the above code should work)