如何在时间完成后重新启动flipclock?
var clock;
$(document).ready(function() {
clock = new FlipClock($('.clock'), 10, {
clockFace: 'Counter',
autoStart: true,
countdown: true
});
});
我希望在一个条件下10秒后重新开始计数器。我试过的是
var clock;
$(document).ready(function() {
clock = new FlipClock($('.clock'), 10, {
clockFace: 'Counter',
autoStart: true,
countdown: true,
callbacks: {
stop: function() {
//my custom condition here if(not_free){start showing again}
clock.start();
}
}
});
});
但这没效果。任何想法?
答案 0 :(得分:4)
尝试将此行添加到停止回调函数中。
clock.setTime(10);
最终代码:
var clock;
$(document).ready(function() {
clock = new FlipClock($('.clock'), 10, {
clockFace: 'Counter',
autoStart: true,
countdown: true,
callbacks: {
stop: function() {
clock.setTime(10);
clock.start();
}
}
});
});