jQuery Workout Timer Plugin Demos

Default (Countup) Timer

Counts up to a specified end time

Repetitions

Indefinite Countup Timer

Counts up indefinitely

Repetitions

Countdown Timer

Counts down once from a starting point to zero

Repetitions

Repeating Countdown Timer

Counts down from a starting point to zero for a set number of repetitions

Repetitions

Double Interval Countdown Timer

Counts down from a starting point to zero, then counts down from a second starting point to zero, for a set number of repetitions

Repetitions

Countdown Timer with Events

Shows how you can bind code to start, pause, restart, roundComplete, and complete events.

Repetitions

Code example:

// Define a function or functions to handle timer events.
var $eventLog = $('#event-log');
var logEvent = function(eventType, eventTarget, timer) {
    var newLog = '"' + eventType + '" event triggered on #' + eventTarget.attr('id') + '\r\n';
    $eventLog.val( newLog.concat( $eventLog.val() ) );
};

// Pass in event handlers as part of the options object
$('.workout-timer-events').workoutTimer({
    onStart: logEvent,
    onRestart: logEvent,
    onPause: logEvent,
    onRoundComplete: logEvent,
    onComplete: logEvent
});

The target function receives three parameters:

  • eventType {String}: The name of the event received
  • eventTarget {jQuery}: The jQuery object that was the target of this event, e.g. the root element of the timer.
  • timer {WorkoutTimer}: A reference to the workout timer that threw this event.