Intermittent scrolling: After a row is scrolled, the delay continues to scroll after 2 seconds
The specific implementation code is as follows:
1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /> 5 <Metaname= "keywords"content= "Keyword 1, keyword 2" /> 6 <Metaname= "Description"content= "description information" />7 <title>Intermittent cycle scrolling</title>8 <!--Css/js -9 <styletype= "Text/css">Ten *{margin:0;padding:0;} One Ul,li{List-style:None;Display:Block;} A #scrollBox{Height:144px;width:300px;margin:100px Auto;background:#f09;Overflow:Hidden;} - #scrollBox #con1, #con2{width:280px;float: Left;} - #scrollBox Li{Line-height:24px;text-align:Center;} the - </style> - - + </Head> - <Body> + <!--Div - A <DivID= "Scrollbox"> at <ulID= "Con1"> - <Li>I am the test content 1!!<Li> - <Li>I am the test content 2!!<Li> - <Li>I am the test content 3!!<Li> - <Li>I am the test content 4!!<Li> - <Li>I am the test content 5!!<Li> in <Li>I am the test content 6!!<Li> - <Li>I am the test content 7!!<Li> to <Li>I am the test content 8!!<Li> + <Li>I am the test content 9!!<Li> - </ul> the * </Div> $ <Scripttype= "Text/javascript"> Panax Notoginseng var Area=document.getElementById ('Scrollbox'); - varlheight= -; the var Time= -; + area.innerhtml+=area.innerhtml; A Area.scrolltop= 0; the vartimer; + functionScrollmove () { - Area.scrolltop++; $ Timer=SetInterval ("Scrollup ()", time); $ } - - functionScrollup () { the if(Area.scrolltop%lheight==0){//2 seconds delay after rolling a line - clearinterval (timer);Wuyi SetTimeout ("Scrollmove ()", -); the }Else{ - Area.scrolltop++; Wu if(Area.scrolltop>=Area.scrollheight/p) { //determines the scroll height, which scrolls back to the origin when the scroll height is greater than the height of the area itself - Area.scrolltop= 0; About } $ } - - } - A SetTimeout ("Scrollmove ()", -);//execute scrollmove after 2 seconds delay + the - </Script> $ </Body> the the </HTML>
Effect preview: Click here for my GitHub
JS instance--Intermittent cycle scrolling