时间到期后,flipclock.js会在刷新时重置 [英] flipclock.js resets on refresh after time expires
本文介绍了时间到期后,flipclock.js会在刷新时重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在本地页面上使用Flipclock.js.一切正常,除了倒数到0后.此页面在我办公室的显示器中使用.我在这另外2页之间轮换.计时器到0后每次重新加载页面时,日期和时间都会变得很混乱.
I'm using Flipclock.js on a local page. Everything works fine, except after the countdown reaches 0. This page is used in a display in my office. I rotate between this an 2 other pages. Every time the page reloads after the timer reaches 0 the dates and time get screwy.
这是代码:
var clocks = [];
$(document).ready(function() {
var currentDate = new Date();
var futureDate = new Date(currentDate.getFullYear() +0, 10, 14, 12, 31);
var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;
clocks.push($('.clock-1').FlipClock(diff, {
clockFace: 'DailyCounter',
countdown: true,
showSeconds: false,
callbacks: {
stop: function() {
$('.message-1').html('Insert message here!');
}
}
}));
推荐答案
尝试使用此代码对我有用
Try to Use This Code This Is Working For Me
var clock;
$(document).ready(function() {
var currentDate = new Date();
var futureDate = new Date(2015,7,16,12,40,10); // (yyyy,m,d) //
var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;
var clock = $('.clock').FlipClock(diff, {
clockFace: 'DailyCounter',
countdown: true
});
});
这篇关于时间到期后,flipclock.js会在刷新时重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文