为什么这在IE中不起作用?我正在使用基思伍德的倒计时插件,更新了插件和 JQuery。所有计时器在 IE 中显示 00:00,并且仅显示第一个计时器。
<script type = "text/javascript">
$(function() {
var i = 0;
$('.countdown').each(function() {
var year = $(this).attr('yr');
var month = $(this).attr('mth') - 1;
var day = $(this).attr('day');
var hour = $(this).attr('hr') - 3;
var minute = $(this).attr('min');
var second = $(this).attr('sec');
var ends = new Date();
ends = new Date(year, month, day, hour, minute, second);
$('#countdown_' + i).countdown({until: ends, format: 'MS', compact: true});
i++;
console.log("Countdown!");
});
});
</script>
您正在减去小时:
var hour = $(this).attr('hr') - 3;
我相信,从我看到的例子中,使用倒计时小时必须大于当前时间。 这将使它小于当前日期,因此始终为零。 尝试添加 3 进行验证。