<div id="counter">countdown not started</div>
var div = $('counter'),
countdown = new CountDown({
//initialized 30s from now
date: new Date(new Date().getTime() + 30000),
//update every 100ms
frequency: 100,
//update the div#counter
onChange: function(counter) {
var text = '';
if(counter.days > 0) text = counter.days + ' d ';
text += (counter.hours > 10 ? '' : '0') + counter.hours + ':';
text += (counter.minutes > 10 ? '' : '0') + counter.minutes + ':';
text += (counter.second > 10 ? '' : '0') + counter.second + ':';
text += ' - ' + (counter.millis > 10 ? '' : '0') + counter.millis + ':';
div.set('text', text)
},
//complete
onComplete: function () {
div.set('text', 'Countdown completed.')
}
});
used to perform updates.
onChange(counter)
Fired when the countdown is completed.
onComplete()
stops the counter / countdown.
starts the counter / countdown.
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus