jquery
2010-11-23 31 views 1 likes 
1

我jQuery代碼是這樣的如何停止的jQuery計時器事件

var job=909; 
var id=0; 
var x=0; 
var maxx=50; 
$(document).everyTime(4000,function(x){ 

    var div= "#ttt_"+x; 
    $(div).hide().load('http://localhost/feed_001.php?job='+job+'&id='+id); 
    var tlHeight = 60; 
    $(div).animate({height: tlHeight},750).fadeIn(2500); 
    x = x + 1; 
    if (x == maxx){ 


     Type here 


    } 
    },0); 

,我想在條件X == MAXX滿足,每次活動將停止事件

回答

1

添加稱爲label一個新的第二個參數然後使用停止時間([LABEL_NAME])

例如:

$(document).everyTime(4000, 'feed_timer', function (x) { 
    ... 
    if (x == maxx) 
    { 
     stopTime('feed_timer'); 
    } 
},0); 
相關問題