Home > Web Front-end > JS Tutorial > body text

Compatible with IE and Firefox's up and down, left and right cycle uninterrupted scrolling JS code_javascript skills

WBOY
Release: 2016-05-16 17:36:19
Original
1107 people have browsed it

Marqueen in HTML can also realize scrolling of content, but the scrolling is intermittent. During a scrolling cycle, a blank period will appear. If the scrolling area is relatively large, the appearance of space will make the page look ugly. Using JavaScript can improve this problem and achieve uninterrupted scrolling.

Scroll up and down the code:

Copy the code The code is as follows:


< ;div id="demo1">
111111111111111

22222222222222

33333333333333

444444444444444< ;br>
555555555555555



<script> <br>var t=getid("demo"),t1=getid(" demo1"),t2=getid("demo2"),sh=getid("show"); <br>var inter; <br>t2.innerHTML=t1.innerHTML; <br>function qswhMarquee(){ <br> if(t2.offsetTop<=t.scrollTop) <BR>t.scrollTop-=t1.offsetHeight; <BR>else <BR>t.scrollTop; <BR>} <BR>inter=setInterval(qswhMarquee,30); <BR>function getid(id){ <BR>return document.getElementById(id); <BR>} <BR></script>

Text scroll left and right code:
Copy code The code is as follows:




Yu Zhiguo Website Design Studio provides professional foreign trade website building services.



Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template