|
|
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.
|
||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||
|