jQuery 定时器插件不工作

jQuery timer plugin not working

你好,我正在尝试 运行 一个 jquery 定时器,使用这里的库:

https://cdnjs.com/libraries/jquery-countdown

当我尝试加载页面时,计时器未显示

这是我的代码:

    <!DOCTYPE html>
    <head>
    <link rel="stylesheet" type="text/javascript" 
     href="http://code.jquery.com/jquery-latest.js">

        <link rel="stylesheet" type="text/javascript" 
     href="https://cdnjs.cloudflare.com/ajax/libs/jquery-
    countdown/2.0.2/jquery.countdown.js">

    <link rel="stylesheet" type="text/css" 
   href="https://cdnjs.cloudflare.com/ajax/libs/jquery-
   countdown/2.0.2/jquery.countdown.css">

  </head>
 <body>
<p>hi</p>
 <div id="getting-started"></div>
 <script type="text/javascript">
  $('#getting-started').countdown('2017/01/01', function(event) {
  $(this).html(event.strftime('%D days %H:%M:%S'));
  });
 </script>
 </body>
 </html>

Update

我认为您引用的 JS 有问题。 尝试从此处引用它 https://cdn.rawgit.com/hilios/jQuery.countdown/2.2.0/dist/jquery.countdown.min.js

并将 CSS 引用更改为 link,因为它不是脚本

<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-countdown/2.0.2/jquery.countdown.css" rel="stylesheet" type="text/css" />

这是你需要写的

$('#getting-started').countdown('2017/01/01', function(event) {
  $(this).html(event.strftime('%D days %H:%M:%S'));
});

JS Fiddle