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