How to set the countdown timer in the flipclock.js plugin? The documentation did not find this item, maybe someone has a ready-made solution?

$(document).ready(function() { var clock = new FlipClock($('.clock'), {}); }); 

    2 answers 2

    I ran it myself, I hope it helps)

      jQuery(document).ready(function($) { var clock; var futureDate = new Date("May 29, 2016 0:00 PM EDT"); var currentDate = new Date(); var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000; function dayDiff(first, second) { return (second - first) / (1000 * 60 * 60 * 24); } if (dayDiff(currentDate, futureDate) < 100) { $('.clock').addClass('twoDayDigits'); } else { $('.clock').addClass('threeDayDigits'); } if (diff < 0) { diff = 0; } clock = $('.clock').FlipClock(diff, { clockFace: 'DailyCounter', language: 'ru', countdown: true }); }); 

    Plunker working example

    • (index): 45 Uncaught TypeError: $ (...). FlipClock is not a function - asd
    • @ads see an example on the planker, everything works - sashatexb

    Here is an example.

     // Instantiate a coutdown FlipClock clock = $('.clock').FlipClock(diff, { clockFace: 'DailyCounter', clockFaceOptions: { countdown: true } }); clock.setCountdown(true); clock.face.on('stop', function() { // add 24 hours worth of seconds to the clock face clock.setFaceValue(24 * 60 * 60); clock.start(); }); 

    http://jsfiddle.net/v66j6r5j/ it is of course strongly customized, but I think you will easily find what you need.

    • Uncaught ReferenceError: diff is not defined - asd
    • @asd I gave a link to the example, var diff = futureDate.getTime () / 1000 - currentDate.getTime () / 1000; - Dmitry Kalinin