Having trouble getting jquery-final-countdown to work

时间:2015-11-18 21:00:52

标签: javascript jquery html css

I would like to implement a modern countdown timer into my website, and I've found this one works very nicely, but after downloading it off of Github I'm having trouble getting it to work! What am I doing wrong?

https://github.com/PragmaticMates/jquery-final-countdown

This is the link to their GitHub, I downloaded the 'demo' folder and opened both the html files, but the countdown won't just start!

Here is my result: http://infntest.altervista.org/countdown/data-attributes.html

This is the tutorial, it's got the whole code: http://goo.gl/D4a9c9

My head tag:

<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/demo.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-countdown/2.0.1/jquery.countdown.min.js"></script>

2 个答案:

答案 0 :(得分:3)

Your jquery-countdown.js file is pointing to the wrong location. Specifically, change this part:

<script type="text/javascript" src="../jquery.final-countdown.js"></script>

Here are all of the Javascript libraries required to run: (not counting css)

<script src="//code.jquery.com/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/kineticjs/5.2.0/kinetic.min.js"></script>
<script src="//final-countdown.pragmaticmates.com/jquery.final-countdown.js"></script>

Working Demo

Source Code

答案 1 :(得分:0)

您似乎没有使用相同的呼叫签名。

他们的例子有:

$(document).ready(function() {
        $('.countdown').final_countdown({
                'start': 1362139200,
                'end': 1388461320,
                'now': 1387461319
        }, function() {
                // Finish Callback
        });
});

注意完成回调