我的flipclock.js走得太快,跳过偶数。
我已经尝试了代码,当我使用callbacks-function时似乎出了问题。
var clock = $('#clock3').FlipClock(new Date("April 10, 2019 18:37:00"), {
clockFace: 'DailyCounter',
countdown: true,
callbacks: {
stop: function () {
$("#myButton3Show").hide();
$("#myButton3Hide").show();
}
}
});
<div class="endgame2">
<img src="Pictures/endgame.png">
<div id="clock3"></div>
<a href="https://www.myvue.com/film/avengers-endgame" target="_blank" id="myButton3Show">About Movie</a>
<a href="https://www.myvue.com/film/avengers-endgame" target="_blank" id="myButton3Hide" style ="display: none">Buy Ticket on Vue</a>
</div>
我想要做的是当倒计时达到0并且电影在电影院外面时,将“关于电影”按钮改为“在Vue上预订票”。
它可以工作,除了时钟太快并跳过偶数。
看起来这是一个known bug应该在最新版本中修复。
如果无法切换到更新版本,您可以尝试以下解决方法:
var next_show = new Date('2019-04-10T00:00:00');
var diff = next_show.getTime() - new Date().getTime();
var showtime = Math.floor(diff/1000);
var clock = $('#clock3').FlipClock({
clockFace: 'DailyCounter',
countdown: true,
callbacks: {
stop: function () {
$("#myButton3Show").hide();
$("#myButton3Hide").show();
}
}
});
clock.setTime(showtime);
clock.start();