我的主页上的倒计时功能存在问题。在chrome中,倒计时javascript函数运行正常。但是在Firefox和IE中,计数完全不同,而不是倒数计数。请参阅下面的代码。谢谢你的帮助。
的Javascript
view.translatesAutoresizingMaskIntoConstraints = false
view.topAnchor.constraint(equalTo: view.superview!.topAnchor).isActive = true
view.bottomAnchor.constraint(equalTo: view.superview!.bottomAnchor).isActive = true
view.leadingAnchor.constraint(equalTo: view.superview!.leadingAnchor, constant: 10).isActive = true
view.trailingAnchor.constraint(equalTo: view.superview!.trailingAnchor, constant: 10).isActive = true
HTML
var countdown = $('.countdown-time');
createTimeCicles();
$(window).on('resize', windowSize);
function windowSize() {
countdown.TimeCircles().destroy();
createTimeCicles();
countdown.on('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function() {
countdown.removeClass('animated bounceIn');
});
}
function createTimeCicles() {
countdown.addClass('animated bounceIn');
countdown.TimeCircles({
fg_width: 0.011,
bg_width: 0.1,
circle_bg_color: '#ffffff',
time: {
Days: {
color: '#66cc9a'
},
Hours: {
color: '#66cc9a'
},
Minutes: {
color: '#66cc9a'
},
Seconds: {
color: '#66cc9a'
}
}
});
countdown.on('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function() {
countdown.removeClass('animated bounceIn');
});
}
答案 0 :(得分:1)
好吧,我想我已经找到了你的问题。根据{{3}},您倒计时或计算的日期应格式如下:YYYY-MM-DD
,而您目前有MM-DD-YY
。如果您重新格式化日期似乎正常工作:
<div class="countdown-time" data-date="2017-03-31 00:00:00"></div>