Home > Web Front-end > JS Tutorial > Thoroughly understand JS seamless scrolling code_javascript skills

Thoroughly understand JS seamless scrolling code_javascript skills

WBOY
Release: 2016-05-16 19:21:56
Original
1102 people have browsed it

I need to roll the code to make something and it is seamless. After working on it for a long time, it still doesn’t work.
I am determined to solve this problem. After research, it is not difficult. The code is as follows:

Program code

Copy code The code is as follows:







aaaaaaaaaaa


aaaaaaaaaaa

a


< p>aaaaaaaaaaa


aaaaaaaaaa

🎜 >



<script> <br>var speed=15 <br>demo2.innerHTML=demo1.innerHTML//Clone demo1 to demo2 <br>function Marquee(){ <br>if(demo2.offsetHeight-demo.scrollTop<=0)//When When scrolling to the junction of demo1 and demo2 <BR>demo.scrollTop-=demo1.offsetHeight//demo jumps to the top <br>else{ <br>demo.scrollTop //If it is horizontal, change all height top to width left <BR>} <BR>} <BR>var MyMar=setInterval(Marquee,speed)//Set the timer <BR>demo.onmouseover=function() {clearInterval(MyMar)}//Clear the timer when the mouse is moved up The device achieves the purpose of stopping scrolling <BR>demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}//Reset the timer when the mouse is moved away <BR></script>




Copy it to an HTM file and run it.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template