JQuery Timers Timer

Source: Internet
Author: User
Tags time interval

1. Everytime (time interval, [timer name], function name, [limit of times], [Wait for function program complete])
2. Onetime (time interval, [timer name], call function)
3. StopTime ([timer name], [function name])


/*************************************************************
* Everytime (time interval, [timer name], function name, [limit of times], [wait function complete])
*************************************************************/

Execute function Test () every 1 seconds
function Test () {
Do something ...
}
$ (' body '). everytime (' 1s ', test);

Performed every 1 seconds
$ (' body '). everytime (' 1s ', function () {
Do something ...
});

Execute every 1 seconds and name the timer named a
$ (' body '). everytime (' 1s ', ' a ', function () {
Do something ...
});

Execute every 20 seconds, up to 5 times, and name the timer named B
$ (' body '). Everytime (' 2das ', ' B ', function () {
Do something ...
},5);

Execute every 20 seconds, infinite number of times, and name the timer named C
If the time interval arrives, but the function is still incomplete, wait for the execution function to complete before continuing the timer
$ (' body '). Everytime (' 2das ', ' C ', function () {
Execute a program that will last more than 20 seconds
},0,true);

/***********************************************************
* Onetime (time interval, [timer name], call function)
***********************************************************/
Minus 10 seconds to execute.
$ (' body '). Onetime (' 1das ', function () {
Do something ...
});

Execute after 100 seconds, and name the timer named D
$ (' body '). Onetime (' 1hs ', ' d ', function () {
Do something ...
});

/************************************************************
* STOPTIME ([timer name], [function name])
************************************************************/
Stop all the timers on the $ (' body ')
$ (' body '). StopTime ();

Stop the timer named a on $ (' body ')
$ (' body '). StopTime (' a ');

Stop timer for all call Test () on $ (' body ')
$ (' body '). StopTime (test);

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.