hilios / jQuery.countdown

The Final Countdown plugin for jQuery
http://hilios.github.io/jQuery.countdown/
MIT License
2.3k stars 720 forks source link

Complicated callback.. #339

Open Louboutin1017 opened 1 year ago

Louboutin1017 commented 1 year ago

Hello Devs,

I'm kind of not sure why the callback and count up function not working.. see my example code.

$(document).ready(function () { "use strict"; // Start countdown $("[data-countdown]").each(function () { var $this = $(this), finalDate = $(this).data("countdown"); $this.countdown(finalDate, function (event) { $this.html(event.strftime("%D days %H:%M:%S")); }); // Callback and countup function if (event.elapsed) { $this.html(event.strftime("After end: <span>%H:%M:%S</span>")); } else { $this.html(event.strftime("To end: <span>%H:%M:%S</span>")); } }); // End });

Thanks for your attention