Home >Web Front-end >Front-end Q&A >Does jquery have a timer?
There is no timer in jquery; you can use the "jQuery Timer" plug-in to implement timers in jquery. The timer in this plug-in: 1. "everyTime(time interval, [calculator name], function name, [number limit], [wait for function program to complete])"; 2. "oneTime (time interval, [timing] "stopTime([timer name], [function name])"; 3. "stopTime([timer name], [function name])".
The operating environment of this tutorial: windows10 system, jquery3.4.1 version, Dell G3 computer.
There is no timer in jquery, which can be implemented through plug-ins.
jQuery Timer is a jquery plug-in that can control the display mode of document elements. Rich parameter settings can control more details of the display. It is an excellent timer plug-in. It is very convenient to use and can support a large number of users. Most scheduled business needs.
jquerytimers-Provides 3 functions:
1. everyTime (time interval, [calculator name], function name, [number limit], [waiting function program] Complete])
//每1s执行函数test() //1s=10 $('body').everyTime('1s','A',test,5);//计时器名称为A最多执行5次 //每1s执行一次,执行无数次(默认为0),若抵达时间,函数还未执行完毕,则等待。 $('body').everyTime(10,'B',test,0,true);
2, oneTime(time interval, [timer name], called function)
//10s=1das=100后执行test,计时器名称为C $('body').oneTime(100,'C',test);
3, stopTime ([Timer name],[Function name])
//停止body上的所有定时器 $('body').stopTime() //停止body上名称为A的定时器 $('body').stopTime('A') //停止body上呼叫test的所有定时器 $('body').stopTime(test)
Video tutorial recommendation:jQuery video tutorial
The above is the detailed content of Does jquery have a timer?. For more information, please follow other related articles on the PHP Chinese website!