如何初始化此jquery倒计时

时间:2011-07-06 12:02:25

标签: javascript jquery-plugins

了解this很酷的jquery倒计时

它的初始化是这样的:

<script type="text/javascript">
$(function () {
$('#countdown').countdown({until:$.countdown.UTCDate(-8, 2011,  1 - 1, 1), format: 'DHMS', layout:
                          '<div id="timer">' + '<hr />'+
                              '<div id="timer_days" class="timer_numbers">{dnn}</div>'+
                              '<div id="timer_hours" class="timer_numbers">{hnn}</div>'+
                              '<div id="timer_mins" class="timer_numbers">{mnn}</div>'+
                              '<div id="timer_seconds" class="timer_numbers">{snn}</div>'+
                            '<div id="timer_labels">'+
                                '<div id="timer_days_label" class="timer_labels">days</div>'+
                                '<div id="timer_hours_label" class="timer_labels">hours</div>'+
                                '<div id="timer_mins_label" class="timer_labels">mins</div>'+
                                '<div id="timer_seconds_label" class="timer_labels">secs</div>'+
                            '</div>'+
                        '</div>'

});
});
</script>

知道如何将它配置到倒计时直到7月14日?并且还要到下午18:00 ??

非常感谢

1 个答案:

答案 0 :(得分:1)

该插件的文档位于:http://keith-wood.name/countdown.html

那里的片段是:

var newYear = new Date(); 
newYear = new Date(newYear.getFullYear() + 1, 1 - 1, 1); 
$('#defaultCountdown').countdown({until: newYear}); 

这使它倒计时到下一个新的一年。要倒计时到特定日期,请设置newyear = new Date(2011, 12-1, 25)(那是圣诞节)。

所以你可以这样做:

$('#defaultCountdown').countdown({until: new Date(2011, 07-1, 4)});