我在本地页面上使用Flipclock.js。一切正常,除非倒数达到0后。此页面用于我办公室的显示器。我在这两个页面之间轮换。每次页面在计时器达到0后重新加载时,日期和时间都会变得棘手。
以下是代码:
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!');
}
}
}));
答案 0 :(得分:1)
尝试使用此代码,这对我有用
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
});
});