Countdown implementation

main
Felix Favre 10 years ago
parent 1f43c46a2c
commit 88dfb2e3a8

@ -0,0 +1,11 @@
$(document).ready(function() {
$.each($('.moment-countdown'), function(i, e) {
var span = $(e);
var text = span.html();
var timestamp = moment(parseInt(span.attr("data-timestamp") * 1000));
span.html(text.replace("%c", timestamp.fromNow()));
setInterval(function() {
span.html(text.replace("%c", timestamp.fromNow()));
}, 1000);
});
});
Loading…
Cancel
Save