Reputation: 49
Hi I have the following counter:
But I would really like to show a message when it reaches zero, on the authors site (http://keith-wood.name/countdown.html under the callback tab) it says this should be the code:
$('#expireMessage').countdown({until: shortly,
expiryText: '<div class="over">It\'s all over</div>'});
$('#expireMessageStart').click(function() {
shortly = new Date();
shortly.setSeconds(shortly.getSeconds() + 5.5);
$('#expireMessage').countdown('option', {until: shortly});
});
I tried for hours but cannot get it to work :(
I do not want a start button, just fill the box with text when the timer expires and apply a other style (#defaultCountdownExpired).
I hope someone can please help me.
Thank you very much in advance
Upvotes: 1
Views: 2156
Reputation: 7288
You can use onExpiry
, like below:
$(function () {
$('#defaultCountdown').countdown({
until: +5,
onExpiry: function() {
$('#defaultCountdown').css("background-color","red");
$('#defaultCountdown').html('<div class="over">It\'s all over</div>');
},});
Upvotes: 2