您好我正在尝试使用来自此处的库运行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>
答案 0 :(得分:0)
我相信你引用的JS存在问题。 尝试从这里引用https://cdn.rawgit.com/hilios/jQuery.countdown/2.2.0/dist/jquery.countdown.min.js
将CSS引用更改为链接,因为它不是脚本
<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'));
});