add delay to Animate
|Reported by:||levitymn||Owned by:|
|Keywords:||chain, fx, animate, delay, pause||Cc:|
Some times you would like there to be a delay between the execution of animations in a chain of animations. An example would be when you have a pop-up display that you want to wait one second before it closes on mouseleave.
An option(al parameter) to jQuery.animate that allows the specification of a delay in milliseconds would provide this functionality.
There are thousands of requests on how to do this, that can easily be found with this google query: http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=rnJ&q=jquery+delay+animation&btnG=Search
Most solutions involve adding an animation to the chain that effectively does nothing. Most likely not very efficient and certainly not clear for code readability.
The other solution that is often suggested it to use setTimeout but that breaks the chain, rendering one of jQuery's core advantages useless.