Reputation: 34200
the link specified below is a jquery timer plugin.
http://keith-wood.name/countdown.html
Also i use the following to start a timer
$('#timer').countdown({until: 12,compact: true, description: ' to Go'});
My question is how do i deduce that the timer has reached 00:00:00 or the time given has elapsed
Thanks..
Upvotes: 2
Views: 2606
Reputation: 89209
the until
field specifies when the countdown reaches this point, then, specify onExpiry
callback function.
From the JS code
onExpiry: null, // Callback when the countdown expires -
// receives no parameters and 'this' is the containing division
For your function:
$('#timer').countdown({until: 12,compact: true, description: ' to Go', onExpiry = executeMyFunction});
function executeMyFunction() {
alert("Tada!");
}
Upvotes: 1
Reputation: 2845
check the documentation..
onExpiry(function) A callback function that is invoked when the countdown reaches zero. Within the function this refers to the division that holds the widget. No parameters are passed in. Use the expiryText or expiryUrl settings for basic functionality on expiry.
$(selector).countdown({ until: liftoffTime, onExpiry: liftOff}); function liftOff() { alert('We have lift off!'); }
Upvotes: 2
Reputation: 11461
Use a callback. This plugin accepts a variable onExpiry
. Pass that in with a reference to the function you want to call when the timer expires.
$('#timer').countdown({until: 12,compact: true, onExpiry:myFunc, description: ' to Go'});
function myFunc() { /* whatever */ }
Upvotes: 3