javascript - Make FlipClock JS work like a countdown - Stack Overflow

I can't make FlipClock.js work. I want to, for example, make a 10 days countdown.I made this fiddl

I can't make FlipClock.js work. I want to, for example, make a 10 days countdown.

I made this fiddle but the flipclock doesn't appear - /

Html:

<html>
    <head>
        <link rel="stylesheet" href="/assets/css/flipclock.css">
    </head>
    <body>
        <div class="your-clock"></div>

        <script src="/assets/js/libs/jquery.js"></script>
        <script src="/assets/js/flipclock/flipclock.min.js"></script>
    </body>
</html>

JavaScript:

var clock = $('.your-clock').FlipClock({
    clock.setCountdown(true);
    clock.setTime(3600);
    clock.setCountdown(true);
});

I can't make FlipClock.js work. I want to, for example, make a 10 days countdown.

I made this fiddle but the flipclock doesn't appear - http://jsfiddle/9hYef/

Html:

<html>
    <head>
        <link rel="stylesheet" href="/assets/css/flipclock.css">
    </head>
    <body>
        <div class="your-clock"></div>

        <script src="/assets/js/libs/jquery.js"></script>
        <script src="/assets/js/flipclock/flipclock.min.js"></script>
    </body>
</html>

JavaScript:

var clock = $('.your-clock').FlipClock({
    clock.setCountdown(true);
    clock.setTime(3600);
    clock.setCountdown(true);
});
Share Improve this question edited Aug 26, 2014 at 7:07 Ben Jones 2,1711 gold badge26 silver badges36 bronze badges asked May 22, 2014 at 7:45 PCMPCM 251 silver badge9 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

Try getting the current date and pare with the desired date:

var huh  = new Date(Date.UTC(2014, 9, 17, 5, 15, 0));
var duh  = new Date();
var wha  = huh.getTime()/1000 - duh.getTime()/1000;

var clock = $('.clock').FlipClip(wha, { // <-- DID YOU MEAN FlipClock
    clockFace: 'DailyCounter',
    countdown: true
});

Flipclock() takes various options, but you'll need to make it a json array

var clock = $('.clock').FlipClock({
    countdown: true
});

What they don't mention very well is that the first parameter can be the start offset, like so

var clock = $('.clock').FlipClock(3600*24*10, {
    countdown: true
});

You can find more working example of this in the faces section of the docs - http://flipclockjs./faces

Here is a working JSFiddle http://jsfiddle/bensjones/swjo7wjt

How I made this work is by using the references section (on the left) rather than putting it in the code areas. This will often confuse the issue and, many times, JSFiddle itself.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742360149a4429231.html

相关推荐

  • javascript - Make FlipClock JS work like a countdown - Stack Overflow

    I can't make FlipClock.js work. I want to, for example, make a 10 days countdown.I made this fiddl

    3小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信