With this plugin you will be able to:
Before you will start using this plugin, make sure you've included jQuery at first:
You can use
Then you can easily make an initialization:
By default, timer has a timeout of 5 seconds, output format is 'H:MM:SS' and initial value is the representation of the initial timeout.
If you have cancelled the timer, you can resume it by starting it again.
When the timer is exhaused and you need to rerun it, reset it first. You can also reset the timer while it is running.
The source code for the example above is listed below. Take a look at timer's initialization at the line #13.
To specify timer's timeout value, pass an object with
See it in action:
By default, timer's output format is
If timer's timeout has days, then they will be converted to hours, e.g.
will result into:
If you want to display days explicitly, then you have to change output format. Days pluralization is up to you. Below you can see the initialization of the same timer as above, but with another output format for handling days. Hours will have leading zero now.
Actually, you may use any format and set placeholders for time intervals in any order:
For some reason you may need to trigger some action when your timer
starts. If you do not want to call it every time manually, you may set an
Callback function accepts
You may also need to trigger some action when timer is being cancelled.
And this is hot it works:
Very probably, you will want to do some action, when your timer is
Let's see how this works:
If you need to perform some action on each tick, while your timer is working, you can set a callback for that event as well.
This will change color of the timer's value each second. Give it a try:
Timer's value is rendered each second by default. If it's too fast for
you, you can set timer's
Here we have a timer which works for 1 minute and renders own value each 5 seconds.
Number of seconds is usually multiple of timer's step. I.e., if we set step to 5 then it will be nice to use number of seconds which is multiple of 5: 5, 10, 15, etc.
But this is not obligatory. For example, if you set 10 for seconds and 4 for step, timer will correctly count 10, 6, 2, 0. Even if your step is greater than number of seconds, this is still valid.
You may be surprised, but this plugin allows you to go on counting below zero. This feature was implemented due to issue #6.
To enable such behaviour, set
See how this works:
As you may noticed, callback functions have
Two of them you are familiar with. They are
So, here you are. At the end of the documentation for backward timer. From now, you may know everything about it. Thanks for reading and good luck with usage!