我遇到了FlipClock.js的麻烦。下面我提供了我网站上的代码示例:
HTML部分:
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8 text-center">
<div id="buttons">
<div class="my-clock"></div>
</div>
</div>
<div>
和javascript部分:
<script type="text/javascript">
var clock;
$(document).ready(function() {
// Grab the current date
var currentDate = new Date();
// Set some date in the past. In this case, it's always been since Jan 1
var pastDate = new Date("2016-02-20 10:00:00");
// Calculate the difference in seconds between the future and current date
var diff = pastDate.getTime() / 1000 - currentDate.getTime() / 1000;
// Instantiate a coutdown FlipClock
clock = $('.my-clock').FlipClock(diff, {
clockFace: 'DailyCounter',
countdown: true
});
});
</script>
这里是Chrome的屏幕:
和Firefox:
在Firefox中,计数器根本不起作用。我能做错什么?