Thoroughly understand JS seamless rolling code. You have to scroll the code when creating something. It's seamless for a long time, but it still doesn't work.
We are determined to solve this problem. It is not difficult to study the code below:
Program code
The Code is as follows:
Aaaaaaaaaaa
Aaaaaaaaaaa
Aaaaaaaaaaa
Aaaaaaaaaaa
Aaaaaaaaaaa
Aaaaaaaaaaa
|
|
Script
Var speed = 15
Demo2.innerHTML = demo1.innerHTML // clone demo1 to demo2
Function Marquee (){
If (demo2.offsetHeight-demo. scrollTop <= 0) // when rolling to the junction of demo1 and demo2
Demo. scrollTop-= demo1.offsetHeight // The demo jumps to the top
Else {
Demo. scrollTop ++ // if it is horizontal, change all height top to width left.
}
}
Var MyMar = setInterval (Marquee, speed) // set the timer
Demo. onmouseover = function () {clearInterval (MyMar)} // clear the timer when you move the cursor up to stop scrolling.
Demo. onmouseout = function () {MyMar = setInterval (Marquee, speed)} // reset the timer when you move the cursor away
Script
Copy to an HTM file to run.