DanielleJ
DanielleJ

Reputation: 39

How can I make several flipclock-countdowns disappear after a certain date?

I have been trying make my countdown clocks to disappear after a movie has been released on the cinema. I used the callbacks, although it re-appears with a negative number on page reload. When I use if-statements, it disables all my countdowns completely. Is there an easy way or explanation for a newbie like me?

This is JavaScript:

var next_show = new Date('2019-04-11T12:54:00');
var diff = next_show.getTime() - new Date().getTime();

var showtime = Math.floor(diff / 1000);
if (next_show.getTime() == new Date().getTime()) {
  $("#clock3").hide();
  $("#myButton3Show").hide();
  $("#myButton3Hide").show();
} else {
  var clock = $('#clock3').FlipClock({
      clockFace: 'DailyCounter',
      countdown: true,
    }
  };

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

Upvotes: 0

Views: 21

Answers (0)

Related Questions