This article describes the method of JS to collect information regularly and display it scrolls based on MSClass and setInterval. Share it for your reference, as follows:
setTimeout is used for delays and is executed only once.
setInterval: Used for multiple executions.
The jquery.timers-1.2.js timer is referenced in the project, and MSClass does information scrolling regularly, executing every 3 minutes, about three times, and the number of scrolling is getting faster and faster. The reason is that both times and MSClass use setInterval,
A setInterval will be added again, which will eventually lead to several setInterval being executed concurrently, so the speed is very fast. You need to clear the last setInterval when calling, or refer to the original method of the MSClass author.
//The timer first executes the destroy instance var Marquee1 = new Marquee(["div1", "Content"])function Marquee_everyTime() { Marquee1.Destroy(); //The destruction instance applies GetMarqueeInfo(); //Then ajax collects the required information and data. }//ajax method function GetMarqueeInfo() { LG.ajax({ type: 'AjaxOther', method: 'GetMarqueeInfo', success: function (data, tipsContent) { $("#Content").html(""); $("#Content").html(tipsContent); //Large container|Small container|Scroll direction|Scroll speed|Width of the large container|Height of the large container|Scroll rest time|Scroll rest time|Scroll end time Marquee1.Direction = 2; Marquee1.Step = 0.4; Marquee1.Width = 640; Marquee1.Height = 30; Marquee1.Timer = 20; Marquee1.DelayTime = 4000; Marquee1.WaitTime = 3000; Marquee1.ScrollStep = 320; Marquee1.Start(); }, error: function () { LG.tip('Information loading failed.'); } });}For more information about JavaScript related content, please check out the topics of this site: "Summary of ajax operation skills in JavaScript", "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm skills", "Summary of JavaScript animation special effects and techniques", "Summary of JavaScript errors and debugging skills", "Summary of JavaScript data structures and algorithm skills", "Summary of JavaScript traversal algorithms and techniques" and "Summary of JavaScript mathematical operations usage"
I hope this article will be helpful to everyone's JavaScript programming.