Search code examples
javascriptjquerycountdown

Hilios jQuery "The Final Countdown" Text After Count


So, I am using Hilios jQuery "The Final Countdown", and I want to add a "Text After Countdown". To make it even better to understand what I want: when the countdown finishes (when the date comes), I don't want it to show 00:00:00:00 or something like that, but to change to text (from 00:00:00:00 to something like "Server Started"). I am no good at this jQuery/Javascript etc. stuff, so can someone help me?

I am using his "Timezone Aware" function/add-on, too.


Solution

  • Just one thing, the outer if is useless, because the finish event will be dispatched when the given date is already finished.

    Other improvement is to register both update and finish as callbacks, the way above you are executing two finish events in a row, use this instead:

    $('#clock').countdown(serverStart.toDate())
    .on('update.countdown', function(event) {
        $(this).html(event.strftime('%D:%H:%M:%S'));
    })
    .on('finish.countdown',function(event) {
        $(this).html("Server Started");
    });
    

    Thank for using the plugin!