jQuery Timer Plugin

Posed under jQuery on June 14, 2009.

Article

Comments

Post

Locker Rushing

Jul 20 2009

Thank you man! Exactly what I needed.

Nice site btw!

Gas Oved

Aug 31 2009

Tiny but very useful plugin. Thank you very much!

Engin Gurelli

Sep 05 2009

Really apreciated Evan, very handy. Thank you.

will

Oct 06 2009

This works great, and so teeny!
Thanks :)

xavier

Oct 30 2009

Enjoy :)
// $(this).animate(xxx).delay(2000,function(){}).animate(xxx)

jQuery.fn.delay = function(t, f)
{
return
$(this).animate({d:1}, t, f) ;
}

Evan Byrne

Oct 31 2009

xavier, that's all fine and good for the most simple of implementations, but your solution doesn't give you the ability to cancel a delayed callback.

Jamie

Nov 28 2009

Just a quick thanks dude, i wasn't looking forward to having to do a delay ;)

Cheers for the plug-in.

George

Dec 08 2009

Beautiful plugin. Works perfectly. Thank you very much.

brett

Jan 19 2010

You're updated script with the cancel command is awesome! Thanks so much :)

Mark

Mar 10 2010

The timer consumes resource as is working till the time event triggers.
It means though we set timer to delay 50000 ms, the system keeps busy on the timer loop. Thanks to multithreading, but it would be better if we could use some alternative.
Evan commented on Xavier, better objective but yet unsatisfying. somebody get more...

plumber

Apr 08 2010

Nice work. Thanks!

Jonathan

Jun 08 2010

THANKS HEAPS ! works like a charm, really was not in the mood to hard code in some settimeout wraps round a horrible ajax form !!!

wynajem

Jun 27 2010

Great work

John Wells

Jul 16 2010

I don't see how this is significantly different from just doing

var x = setTimeout( function() {

// stuff here

}, timeHere);

and

clearTimeout(x);

Maybe I'm missing something, but it's not more verbose than jQuery.

What I really want is to be able to set a delay in my current thread without locking the browser.

I need to:

myFunction() {

// Do stuff

// delay here

// Carry on here

}

I can't split into multiple functions -- I absolutely must stay within my function. However if I just do a tight loop waiting for a predetermined time, it will lock up any other background threads that I had running.

Really hoping to find a way around this -- any advice much appreciated.

dotacje na kolektory

Jul 24 2010

Awesome script. Simble, but fine and useful. Thanks!

pete

Oct 10 2010

Im trying to get this to work on an animation.

I need a delay so that when people are browsing over my thumnails the animations are not firing, but i can't get this to work. Can anyone take a look at my code you can see it here.

http://www.petergaskell.co.uk/tests/slides.html

would really appreciate the help. if i place any of the timer within my function it breaks.

Post Comment

Capcha