eozzy
eozzy

Reputation: 68790

jQuery Delay Time

Can I do this to increase the time:

delay(10000*10)

Upvotes: 0

Views: 3319

Answers (2)

Andy
Andy

Reputation: 30135

why not just try it :)
http://jsfiddle.net/utj6h/

Upvotes: 3

Rion Williams
Rion Williams

Reputation: 76607

Sure, assuming you are using some type of function that handles the delay I use something similar to the following (to set a Refresh Rate, which is stored in the Session):

setInterval(function ()
{
    var grid = $('#GridName').data('tGrid');
    grid.ajaxRequest();
}, <%= int.Parse(Session["RefreshRate"].ToString())*1000 %>);

so for your usage:

setInterval(function ()
{
    //Refresh logic

}, (10000*10)); //Your delay goes here

Delay function:

var delay = (function(){
        var timer = 0;
        return function(callback, ms){
        clearTimeout (timer);
        timer = setTimeout(callback, ms);
    };
    })();

Edit: Totally neglected the jQuery delay() function, which should be working as you have written. If not, it may not like the calculation inside the argument and you could try:

var delay = 10000*10;

.delay(delay)

Upvotes: 0

Related Questions