Search tutorials
The Main Function
Here's the function that does that:
function scrollit()
{
//get the total length of the scroller (white rectangle)
scrollerlength=document.scroll1.document.scroll2.document.width
//if the scroller's left position is greater than -scrollerlength (hasn't reached the end)
if (document.scroll1.document.scroll2.left>=scrollerlength*(-1))
{
//decrease it's left position by 6 pixels
document.scroll1.document.scroll2.left-=6
setTimeout("scrollit()",100)
}
else
{
//else if the scroller has reached the end, reset the scroller position
document.scroll1.document.scroll2.left=300
//and start things all over
scrollit()
}
}
Read my comments inside to see how it works. Basically, the idea is to decrease the "left" value of the layer continuously, until it reaches the end of the layer. Then, repeat and start all over again from it's original position.
| » Level Intermediate |
|
Added: 2000-12-18 Rating: 6.89 Votes: 56 |
| » Author |
| No information about the author has been provided |
| » Download |
| Download the files used in this tutorial. |
| Download (0 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!