开发者

jquery - resetting timer

im using a plugin to do something ever 10 secs:

function status_updates(){
    $("p").everyTime(1000,function(i) { 
        if(i==10){
            alert("foo");
            // something here
        }else{
            $(this).html(i);    
        }
    开发者_开发技巧});
}
status_updates();

where it says something here I need to add something to reset the timer but i dont know how. The plugin is here: http://jquery.offput.ca/every/ or if you know of an other way it would be much appreciated.


If you test with i==10, alert will be triggered just once.

Try with this:

function status_updates(){
    $("p").everyTime(1000,function(i) { 
        if(i % 10 == 0){
            alert("foo");
            // something here
        }else{
            $(this).html(i);    
        }
    });
}
status_updates();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜