いずれも動作しませんでした、setTimeout
はあなたがすべての保留中のタイムアウトをキャンセルするために使用できるユニークなtimeoutIDはを返します。 window.clearTimeoutを使用してください。
ので、そのままあなたのコードのほとんどを保ち、あなたは
var interval, timeout;
var graph = function(){
$('.graph-line1').addClass('graph-line1-animate');
timeout = setTimeout(function(e){
$('.graph-line2').addClass('graph-line2-animate');
timeout = setTimeout(function(e){
$('.graph-line3').addClass('graph-line3-animate');
//... rest of the timeouts
を書くことができそして "アウトホバー" コールバック
clearInterval(interval);
clearTimeout(timeout);
Here's a working fiddleインチ
これらのネストされたタイムアウトは、「コールバック・ヘル」を避けるために、もう少しきれいに書くことができます。 Here's my quick attemptでも、あなたはもっと良くすることができると確信しています。
ニース、それは働きました!どうもありがとうございます!私は完全にタイムアウトをリセットすることを忘れていた:p –