我试图使用progressbar.js计算两个周期之间的交替。当我运行这段代码时没有任何反应,即使它在我不想重复的时候工作正常。有什么建议吗?
$(document).ready(function() {
var timer = new ProgressBar.Circle('#progress', {
easing: 'linear',
strokeWidth: 3,
trailWidth: 1,
color: '#ff9900'
});
function loop() {
timer.set(0);
timer.setText('Work');
timer.animate(1, {
duration: 25000
}, function() {
timer.set(0);
timer.setText('Break');
timer.animate(1, {
duration: 5000
},loop);
});
loop();
}
});
答案 0 :(得分:1)
function loop() {
timer.set(0);
timer.setText('Work');
timer.animate(1, {
duration: 25000
}, function() {
timer.set(0);
timer.setText('Break');
timer.animate(1, {
duration: 5000
},loop);
});
loop(); //remove
}
loop();//add