abchase
abchase

Reputation: 43

flipclock.js resets on refresh after time expires

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.

Here is the code:

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!');
                    }
                }
}));

Upvotes: 0

Views: 1478

Answers (1)

Urooj Khan
Urooj Khan

Reputation: 177

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
});
});

Upvotes: 1

Related Questions