自定义倒计时JS [关闭]

时间:2014-06-09 09:53:04

标签: jquery countdown

我按照倒计时库http://keith-wood.name/countdown.html使用此代码显示计时器

var def = 2 * 60 * 1000;
var now = new Date();
var timer = new Date(now.getTime() + def);
$('#countdown').countdown({until: timer});

输出是3分钟,但我需要输出180倒计时179,178,177 .. 0.如何定制?

解决方案添加: format: 'S'

添加输入文字: layout:'<input type="text" value="{sn}">'

感谢Rahul Gupta和jeek在线

2 个答案:

答案 0 :(得分:0)

我希望这正是您所寻找的:

var def = 3 * 60 * 1000; 
var now = new Date();
var timer = new Date(now.getTime() + def);
$('#countdown').countdown({until: timer, format: 's'});

答案 1 :(得分:0)

这是工作JSFIDDLE JS代码:

var now = new Date();
now.setSeconds(now.getSeconds() + 180);
$('#countdown').countdown({until: now, format: 'S'});