jQuery Timer Plugin
Time does not change us. It just unfolds us.
I m happy to post about my first ever jQuery plugin. This plugin will allow you to add a simple timer to a HTML element like DIV or SPAN or any other valid display element. You can style this element to show the timer in a nice way
Currently this plugin has 3 self explainatory methods to interact with it:
- $(“#divId”).timer(“start”); -> this will initialize the timer inside the div with id = “divId”. You can even pass in the number of seconds you’d like to start the timer at, like this, $(“#divId”).timer(“start”, 2500);
- $(“#divId”).timer(“pause”); -> this will pause a started timer
- $(“#divId”).timer(“resume”); -> and this will obviously resume a paused timer.
Make sure to include the latest jQuery file and this plugin file in your HEAD section. Click here for a demo of this plugin. Download the zipped folder (includes the plugin + demo HTML page) from GitHub. Here’s the script itself.