View on GitHub

TimeTo - jQuery Plugin

jQuery plugin - timer countdown digital clock

Download this project as a .zip file Download this project as a tar.gz file

TimeTo

jQuery plugin - timer countdown digital clock

Examples

Countdown timer

Set delay in seconds

$('#countdown').timeTo(100, function(){ alert('Countdown finished'); });

Set delay to specyfied datetime

$('#countdown').timeTo(new Date('Dec 10 2013 00:00:00 GMT+0200 (EET)'));

Set captions and dark theme

$('#countdown').timeTo({
    timeTo: new Date(new Date('Dec 10 2013 00:00:00 GMT+0200 (EET)')),
    displayDays: 2,
    theme: "black",
    displayCaptions: true,
    fontSize: 48,
    captionSize: 14
});

Controlled by an event

  var $countdown = $('#countdown');
  var $button = $('button');
  var timeout = 5e3;

  $countdown.timeTo(new Date(Date.now() + timeout),
    function() {
      $countdown.hide();
      $button.prop('disabled', false).text('Start');
    }
  );

  $action.click(function() {
    $button.prop('disabled', true).text('processing...');
    $countdown.show().timeTo(new Date(Date.now() + timeout));
  });

  $button.prop('disabled', true).text('processing...');

Digital clock

$('#clock-1').timeTo();

Usage

$(<selection>).timeTo([options]);

Whithout options it makes simple digital clock with current system time.

where options can be...

Options

Object with initial settings:

Integer

Initial setting for seconds option

$('#clock').timeTo(100)
// is identical to
$('#clock').timeTo({
    seconds: 100
});

Date object

Initial setting for timeTo option

$('#clock').timeTo(new Date('Dec 10 2013 00:00:00'));
// is identical to
$('#clock').timeTo({
    timeTo: new Date('Dec 10 2013 00:00:00')
});

String

Action for execute. Available: 'start', 'stop', 'reset'.