You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
jQuery(function ($) { // custom formatting example
$('#earth').data('countToOptions', { formatter: function (value, options) { return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ','); } });
// custom callback when counting completes
$('#countdown').data('countToOptions', { onComplete: function (value) { $(this).text('BLAST OFF!').addClass('red'); } });
// another custom callback for counting to infinity
$('#infinity').data('countToOptions', { onComplete: function (value) { count.call(this, { from: value, to: value + 1000 }); } });
// start all the timers
$('.timer').each(count);
// restart a timer when a button is clicked
$('.restart').click(function (event) { event.preventDefault(); var target = $(this).data('target'); $(target).countTo('restart'); });
function count(options) { var $this = $(this); options = $.extend({}, options || {}, $this.data('countToOptions') || {}); $this.countTo(options); } });
|