pravat231
pravat231

Reputation: 780

how to stop jquery timer event

My jquery code is this

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);

And i want when the condition x == maxx satisfies the everytime event will stop event

Upvotes: 1

Views: 2200

Answers (1)

John Giotta
John Giotta

Reputation: 16934

Add a new second argument known as label then use stopTime([label_name])

For example:

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

Upvotes: 1

Related Questions