Countdown implementation

This commit is contained in:
Felix Favre 2014-08-24 16:44:36 +02:00
parent 1f43c46a2c
commit 88dfb2e3a8
1 changed files with 11 additions and 0 deletions

View File

@ -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);
});
});