user2765741
user2765741

Reputation: 49

jQuery Countdown text message on expiry

Hi I have the following counter:

http://jsfiddle.net/a9Nk6

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

Answers (1)

Bla...
Bla...

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

Related Questions