Delay that order

Because timing is everything, I often discover I want a function's animation to complete, and yet, depending on the easing option, especially those that are elastic or bounce, I don't necessarily want the very next function to kick off quite so fast! As of jQuery 1.4, it's easy to pause the chain with the .delay() function. Let's place a three second pause in our chain like so:

.slideDown(5000, 'linear') .delay(3000) .fadeTo('slow', .5);

Check your jQuery version! delay() requires 1.4+

As soon as this function became available, I've put it to use in all sorts of invaluable ways with my jQuery animations. However, if you find the delay function is not working for you, you're probably working with version 1.3.2 or older of jQuery. The delay function is only available with version 1.4+. You may want to go back to Chapter 2, Working with jQuery in WordPress and see about registering jQuery from the Google CDN or including it directly in your theme.

Blogging For Business

Blogging For Business

Download this Guide And Discover How Start And Run Your Very Own Successful Business Blog. Always Wanted To Start Your Own Blog?

Get My Free Ebook

Post a comment