倒数达到0后,如何永远销毁翻转时钟?

时间:2019-04-11 18:32:26

标签: javascript jquery callback flipclock

我希望倒数时钟在达到0后永远消失。该怎么办?

我尝试了回调,但是页面加载后时钟又回来了,我的if和else语句不起作用。我需要一些聪明的人来帮助我,因为我失败了。

这就是我现在正在使用的东西:

<div class="captainmarvel2" style="width: 30%">
  <img src="Pictures/captainlogo.png">
  <h5>In Theaters 8 March 2019</h5>
  <div id="clock3"></div>
  <a href="https://www.marvel.com/movies/captain-marvel" target="_blank" id="myButton3Show">About Movie</a>
  <a href="https://www.myvue.com/film/captain-marvel" target="_blank" id="myButton3Hide" style="display: none">Buy Ticket on Vue</a>
</div>
/*Countdown until Captain Marvel Release */
var next_show = new Date('2019-04-11T14:21: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 () {
      $("#clock3").fadeOut(1000);
      $("#myButton3Show").fadeOut(1000);
      $("#myButton3Hide").fadeIn(1000);
      if (getTime == new Date) {
        return; //stop the execution of function
      }
    }
  }
});

clock.setTime(showtime);
clock.start();

我希望时钟在达到0后永远消失,并且要将按钮从“关于电影”更改为“在Vue上购买票证”。

0 个答案:

没有答案