2011-10-25 30 views
2

我正在使用这些jQuery插件:jQuery Countdown如何使用jQuery Countdown设定目标时间

我试图让它每天倒数到17:00(下午5:00),但我似乎无法设定时间。

欢迎任何帮助。

我的代码是:0

$(function() { 
    var now = new Date() 
    var since = new Date(now.getFullYear(), now.getMonth(), now.getDay(), 17, 00); 
    $('#noDays').countdown({until: since, format: 'HMS'}); 
}); 

定时器stucks与此代码。

+0

请出示你的代码,并解释你运行时会发生什么。 – nnnnnn

+0

17:00之前是什么意思? 可以请你详细说明,也许我可以帮你,我在我自己的项目中使用这个插件。 – Genjuro

回答

2

试试这个(和工作例如here):

$(function() { 
    var liftoff = new Date(); 
    liftoff = new Date(liftoff.getFullYear(), liftoff.getMonth(), liftoff.getDate(), 17, 0, 0); 

    $('#noDays').countdown({until: liftoff}); 
}); 
+0

完美,谢谢! –

1

想想你在寻找这样的:

var now = new Date() 
var since = new Date(now.getFullYear(), now.getMonth(), now.getDay(), 17, 00); 
+0

'$(函数(){ \t变种现在=新日期() VAR因为=新日期(now.getFullYear(),now.getMonth(),now.getDay(),17,00); $ ('#noDays')。countdown({until:since,format:'HMS'}); });'不起作用。定时器在0 –

相关问题