JS+CSS implementation of discontinuous and uninterrupted text scrolling code _ text effects

Source: Internet
Author: User
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <title>js+css discontinuous and uninterrupted text scrolling code </title> <meta http-equiv= "Content-type" content= "text/html;charset=gb2312" > <style type= "text/css" > Box{width : 150px;height:25px;line-height:25px;border: #bbb 1px solid;overflow:hidden;} . Box ul{margin:0;padding:0}. Box Li{height:25px;line-height:25px;font-size:12px;text-align:center;list-style-type : none; </style> </pead> <body> <div class= "box" id= "marqueebox0" > <ul> <li > First line &LT;/LI&G T <li > second line </li> <li > Third line </li> </ul> </div><br> <div class= "box" id= "marquee" Box1 "> <ul> <li > First line </li> <li > second line </li> <li > Third line </li> </ul> </ div> <script type= "Text/javascript" > Function StartMarquee (LH, speed,delay,index) {var t; var P=false; var O=document.getelementbyid ("Marqueebox" +index); o.innerhtml+=o.innerhtml; O.onmouseover=function () {p=true} o.onmouseout=function () {p=false} o.scrolltop = 0; function Start () {t=setinterval (scrolling,speed); if (!p) {o.scrolltop + = 1;} The function scrolling () {if (o.scrolltop%lh!=0) {o.scrolltop = 1; if (O.SCROLLTOP&GT;=O.SCROLLHEIGHT/2) o.scrolltop = 0; }else{clearinterval (t); SetTimeout (Start,delay); } settimeout (Start,delay); } startmarquee (25,30,3000,0); StartMarquee (25,40,0,1); </script> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Related Article

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.