At the end of the moveobj.js script, change this:
Code:
document.getElementById(chip.named).style.left=chip.xx+"px";
document.getElementById(chip.named).style.top=chip.yy+"px";
chip.timer1=setTimeout("movechip('"+chip.named+"')",100);
}
}
to:
Code:
document.getElementById(chip.named).style.left=chip.xx+"px";
document.getElementById(chip.named).style.top=chip.yy+"px";
if(!chip.stop)
chip.timer1=setTimeout("movechip('"+chip.named+"')",100);
else
document.getElementById(chip.named).style.display = 'none';
}
}
Then in the on page portion of the script, add the highlighted:
Code:
<script type="text/javascript">
/***********************************************
* Floating image script- By Virtual_Max (http://www.geocities.com/siliconvalley/lakes/8620)
* Modified by Dynamic Drive for various improvements
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
//Step 1: Define unique variable names depending on number of flying images (ie:3):
var flyimage1
function pagestart(){
//Step 2: Using the same variable names as 1), add or delete more of the below lines (60=width, height=80 of image):
flyimage1=new Chip("flyimage1",84,149);
//Step 3: Using the same variable names as 1), add or delete more of the below lines:
movechip("flyimage1");
setTimeout(function(){flyimage1.stop = true;}, 3000);
}
if (window.addEventListener)
window.addEventListener("load", pagestart, false)
else if (window.attachEvent)
window.attachEvent("onload", pagestart)
else if (document.getElementById)
window.onload=pagestart
</script>
Notice the red 3000. That's the number of milliseconds until the thing will stop and disappear. 3000 = 3 seconds, probably way too short a time for this, and just an example. Increase that number as desired.
Bookmarks