繁体   English   中英

jQuery.countdown通过秒而不是时间

[英]jQuery.countdown pass seconds instead of time

我们正在尝试使用jQuery.countdown,并且由于它取决于本地时间,因此我们希望将秒数传递给它。 我们正在使用多个实例。 我们将如何传递秒数直到结束而不是日期?

<div data-countdown="2016/01/01 01:32:12"></div>
<div data-countdown="2017/01/01 04:12:25"></div>
<div data-countdown="2018/01/01 01:12:22"></div>
<div data-countdown="2019/01/01 00:22:21"></div>
$('[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'));
    });
});

如果有人可以创建自定义函数,而不是jquery.countdown-我们也可以使用它。

在倒数计时中使用格式选项作为“ S”

$this.countdown({
   until: someTime,
   format: 'S' )}

文件资料

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM