Use JavaScript to complete text-up intermittent scrolling

Source: Internet
Author: User

Use JavaScript to do intermittent scrolling of text

CONST INIT = (InitData) ={Const area=Initdata.area;//sets the height of the single-line scrolling;Const Ilineheight = initdata.ilineheight? Initdata.ilineheight:24;//set the speed of scrolling;Const SPEED = Initdata.speed? Initdata.speed:50; let time;//setting the delay;Const DELAY = Initdata.delay? initdata.delay:2000; Area.scrolltop= 0;//cloning the entire container, here can also not clone the entire container content, as needed to clone, as long as it is guaranteed to scroll once again wait for the next scrolling before the beginning of the white space is good;Area.innerhtml + =area.innerhtml;//Scroll up the main function;  functionStartscroll () { time= SetInterval (() =Scrollup (), speed); Area.scrolltop++; }//judgment function;  functionScrollup () {//determines whether it is an integer multiple of the number of rows;    if(area.scrolltop% Ilineheight = = = 0) {clearinterval (time); //setting the delay;setTimeout (startscroll, delay); } Else{area.scrolltop++; //determine if all scrolling has completed, if, initialize;      if(Area.scrolltop >= AREA.SCROLLHEIGHT/2) {Area.scrolltop= 0; }    }  }//start the whole function;setTimeout (startscroll, delay);}; Const MARQUEE= (initdata) = ={init (initdata);}; ExportdefaultMarquee

If you have any questions, please leave a message (???)

Use JavaScript to complete text-up intermittent scrolling

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.