Harea Costicla Harea Costicla - 17 days ago 5
Javascript Question

Check if countdown end

I have this code :

$(document).ready(function(){
$("#CDT")
.countdown("{{ aReturn.sAuctionEndDate }}", function(event) {
$(this).html(
event.strftime('' +
'<span class="number-wrapper" style="float: left"><div class="line"></div><div class="caption">Day</div><span class="number day">%D</span></span>' +
'<span class="number-wrapper" style="float: left"><div class="line"></div><div class="caption">Hour</div><span class="number hour">%H</span></span>' +
'<span class="number-wrapper" style="float: left"><div class="line"></div><div class="caption">Minute</div><span class="number min">%M</span></span>' +
'<span class="number-wrapper" style="float: left"><div class="line"></div><div class="caption">Second</div><span class="number sec">%S</span></span>')
);
});

});


But I don't know how to know when the countdown ends. Can you help me please?

Answer

Try this ...

$(document).ready(function(){
    $("#CDT")
        .countdown("{{ aReturn.sAuctionEndDate }}", function(event) {
            $(this).html(
                event.strftime('' +
                        '<span class="number-wrapper" style="float: left"><div class="line"></div><div class="caption">Day</div><span class="number day">%D</span></span>' +
                        '<span class="number-wrapper" style="float: left"><div class="line"></div><div class="caption">Hour</div><span class="number hour">%H</span></span>' +
                        '<span class="number-wrapper" style="float: left"><div class="line"></div><div class="caption">Minute</div><span class="number min">%M</span></span>' +
                        '<span class="number-wrapper" style="float: left"><div class="line"></div><div class="caption">Second</div><span class="number sec">%S</span></span>')
            );
        })
    .on('finish.countdown', function() {
      // do something when countdown finished.
    });

});