jQuery plugin for countdown (or countup) timers based on Moment.js
Depends on jQuery and Moment.js.
Count down from 3 minutes using default time format 'm:ss'.
$('span.countdown').ticktick({duration: [3, 'minutes']});
Count down from three and a half minutes. Note the use of the object-based duration specification from Moment.js.
$('span.countdown').ticktick({duration: {minutes: 3, seconds: 30}});
Count down from 3 minutes using a custom time format. Any format that works in Moment.js, works in jquery.ticktick.
$('span.countdown').ticktick({format: 'm [minutes] ss [seconds]', duration: [3, 'minutes']});
You can even use HTML in your formats (and, of course, you can style them arbitrarily with CSS).
$('span.countdown').ticktick({format: 'h:[<strong>]mm[</strong>]:ss', duration: [3, 'minutes']});
Count down from an hour, specifying an alternate format and a callback on completion.
$('span.countdown').ticktick({duration: {hour: 1}, format: 'hh:mm:ss'}, onDone: function() { alert("Blast off!"); });
Count up, rather than down.
$('span.countup').ticktick({direction: 'up', duration: [3, 'minutes']});