jquery timer (jquery timer plugin)

Source: Internet
Author: User

JQuery Timers Plugin Address:

Http://plugins.jquery.com/project/timers

JQuery Timers Application Knowledge
Three functions are available
1. EveryTime (time interval, [timer name], function name, [frequency limit], [wait for function completion])
2. OneTime (time interval, [timer name], calling function)
3. StopTime ([timer name], [function name])
/*************************************************************
* EveryTime (time interval, [timer name], function name, [frequency limit], [wait function complete])
*************************************************************/
Execute function test every 1 seconds ()
function Test () {
Do something ...
}
$ (' body '). everyTime (' 1s ', test);
Executes every 1 seconds
$ (' body '). everyTime (' 1s ', function () {
Do something ...
});
Executes every 1 seconds and names the timer named a
$ (' body '). everyTime (' 1s ', ' A ', function () {
Do something ...
});
Executes every 20 seconds, up to 5 times, and names the timer name b
$ (' body '). EveryTime (' 2das ', ' B ', function () {
Do something ...
},5);
Execute every 20 seconds, unlimited, and name the timer named C
If the time interval is reached, but the function is still not completed, wait for the execution function to finish before continuing the timing
$ (' body '). EveryTime (' 2das ', ' C ', function () {
Execute a program that will take more than 20 seconds
},0,true);
/***********************************************************
* OneTime (time interval, [timer name], calling function)
***********************************************************/
10 seconds after the countdown.
$ (' body '). OneTime (' 1das ', function () {
Do something ...
});
100 seconds after the countdown, and the name timer named D
$ (' body '). OneTime (' 1hs ', ' D ', function () {
Do something ...
});
/************************************************************
* STOPTIME ([timer name], [function name])
************************************************************/
Stop all timers on $ (' body ')
$ (' body '). StopTime ();
Stop a timer named a on $ (' body ')
$ (' body '). StopTime (' A ');
Stop the timer for all call Test () on $ (' body ')
$ (' body '). StopTime (test);
Custom time Units
Open Source Code
Found it
Powers: {
Yeah This is major overkill ...
' MS ': 1,
' CS ': 10,
' DS ': 100,
' s ': 1000,
' Das ': 10000,
' HS ': 100000,
' KS ': 1000000
}

Example:

1 <script src= "http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type= "Text/javascript" ></ Script>
<script type= "Text/javascript" src= "Http://files.cnblogs.com/dachie/jquery.timers-1.2.js" ></script>2<script type= "Text/javascript" >//<! [Cdata[3 functionCheck () {4$ ("#Button1"). attr ("Disabled",true);5$ ("#Button1"). Val ("Submitting, please wait 3 seconds ...");6$ (' body '). OneTime (' 3s '),function() {7$ ("#Button1"). attr ("Disabled",false);8$ ("#Button1"). Val ("Test Commit"));9 });Ten } One //]]></script>
<input id= "Button1" type= "Submit" Name= "Button1" value= "test Submission" >

jquery timer (jquery timer plugin)

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.