Wednesday, February 16, 2011

Creating a timer with JQuery Timer

Just found a great plugin that allows me create a timer with jquery instead of using pure javascript.
You can download the plugin here Jquery Timer.
To use the plugin to create a timer,use the everyTime function like this,
$('#timer').everyTime(1000,'label',function(){


                     //add timer tick function here
                    $('#span1').html(count);
});
The everyTime function allows you to use a label,so you can create and stop separate timer instances.

To stop the timer, call stopTime.
 $('#timer').stopTime('label');
 and thats it.
download sample code Here


No comments:

Post a Comment