我製作了一段時間間隔的動畫。這是我的腳本:clearinterval with javascript
var count = 0;
var countSecond = -40;
function arrowAnimation() {
if (count > 40) {
clearInterval();
}
$('.list-what-we-do .arrow').css({
top: (count++) + 'px'
});
}
function arrowAnimationSecond() {
if (countSecond > 0) {
clearInterval();
}
$('.list-what-we-do .arrow').css({
right: (countSecond++) + 'px'
});
}
setInterval(arrowAnimation, 5);
setInterval(arrowAnimationSecond, 5);
現在我的問題。我怎樣才能停止間隔。我用clearInterval。但那不起作用。我怎樣才能解決這個問題?感謝您的幫助!
你沒有捕獲從設定的時間間隔返回值和用它作爲清晰間隔的論據。 – ryadavilli