Rooster is a simple jquery plugin that injects a timer, manages the countdown, and handles a few events based on the timer state.
Define an element in your DOM with optional data attributes.
<div class="timer" data-rooster-seconds=60 data-rooster-oncomplete="alert('Timer complete!');">
[Optional] Initialize the plugin on your element on page load to load the unstarted timer with the full time.
$(document).ready(function() {
$('.timer').rooster();
});
Start the countdown!
$('.timer').rooster('start');
[Optional] You can also select the element, define the countdown attributes, and start the timer all in a single call
$('.different-timer').rooster(
'start',
{
seconds: 60,
oncomplete: function() {
alert('Timer complete!');
}
}
);
Basic example: http://mhotwagner.github.io/jquery-rooster/examples/basic.html
- onStart handling
- onStop handling
- onInterval handling
- onSecond handling
- Date/time formatting
- Support beyond minutes