Collect and organize the rolling _javascript in four directions

Source: Internet
Author: User

Scroll up

<textarea id="runcode3802"></P> <p><div Id=demo style=overflow:hidden;height:100;width:90; Background: #214984 color: #ffffff > <div id=demo1> </div> <div id=demo2> ;</div> </div> <script> var speed=30 demo2.innerhtml=demo1.innerhtml//clone demo1 to Demo2 F Unction Marquee () {//when scrolling to the junction of Demo1 and Demo2 if (demo2.offsettop-demo.scrolltop<=0) demo.scrolltop-= Demo1.offsetheight//demo jumps to the top else{demo.scrolltop++} var mymar=setinterval (marquee,speed)/Set timer//mouse move Demo.onmouseover=function () {clearinterval (MyMar)}//Reset timer demo.onmouseout=function () {MyMar When mouse is removed when the timer is cleared to reach the end of the scroll stop =setinterval (marquee,speed)} </script> </P> <P></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Scroll down

<textarea id="runcode95516"></P> <P> <div Id=demo style=overflow:hidden;height:100;width:90; Background: #214984 color: #ffffff > <div id=demo1> </div> <div id=demo2>& Lt;/div> </div> <script> var speed=30 demo2.innerhtml=demo1.innerhtml Demo.scrolltop=d Emo.scrollheight function Marquee () {if (demo1.offsettop-demo.scrolltop>=0) Demo.scrolltop+=demo2.offseth Eight else{demo.scrolltop--}} var mymar=setinterval (marquee,speed) demo.onmouseover=funct Ion () {clearinterval (MyMar)} demo.onmouseout=function () {Mymar=setinterval (marquee,speed)} </script> </p > <P></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Scroll left

</P> <p><div id= "Demo" > <table cellpadding= "0" cellspacing= "0" border= "0" > &LT;TR&G T;&LT;TD id= "Demo1" valign= "Top" align= "center" > <table cellpadding= "2" cellspacing= "0" border= "0" > &LT;TR align= "center" > <td></td> <td></td> &LT;TD&GT;&LT;/TD&G T <td></td> <td></td> </tr> </table> </td > <td id= "Demo2" valign= "Top" ></td> </tr> </table> </div> The;script> var speed=1//speed value is slower demo2.innerhtml=demo1.innerhtml function Marquee () {if Demo2.offsetwidth-demo. scrollleft<=0) demo.scrollleft-=demo1.offsetwidth else{demo.scrollleft++} var mymar=setinterval (Marquee , speed) Demo.onmouseover=function () {clearinterval (MyMar)} demo.onmouseout=function () {Mymar=setinterval (Marquee, Speed)} </script> </P> <P>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Scroll Right

</P> <p><div id= "Demo" > <table cellpadding= "0" cellspacing= "0" border= "0" > &LT;TR&G T;&LT;TD id= "Demo1" valign= "Top" align= "center" > <table cellpadding= "2" cellspacing= "0" border= "0" > &LT;TR align= "center" > <td></td> <td></td> &LT;TD&GT;&LT;/TD&G T <td></td> <td></td> </tr> </table> </td > <td id= "Demo2" valign= "Top" ></td> </tr> </table> </div> ;script> var speed=1//speed number is slower demo2.innerhtml=demo1.innerhtml function Marquee () {if (demo.scrollleft<=0) Demo.scrollleft+=demo2.offsetwidth else{demo.scrollleft--}} var mymar=setinterval (marquee,speed) demo.onm Ouseover=function () {clearinterval (MyMar)} demo.onmouseout=function () {Mymar=setinterval (Marquee,speed)} </ Script> </P> &LT P>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.