Add a pause or delay in jQuery
UPDATE: jQuery introduced a .delay() method in version 1.4, so this trick is no longer needed.
Karl Swedberg over at Learning jQuery has a great trick for pausing during a jQuery effect chain.
Here's an example that fades an object in, pauses for 3 seconds, and then fades the object out.
$("#some_object").fadeIn().animate({ opacity: 1.0 },3000).fadeOut();
Notice the animate() in there. All it does is change the opacity of an object from 1.0 to 1.0 (i.e. do nothing) over the span of 3 seconds. Brilliant.
Karl Swedberg over at Learning jQuery has a great trick for pausing during a jQuery effect chain.
Here's an example that fades an object in, pauses for 3 seconds, and then fades the object out.
$("#some_object").fadeIn().animate({ opacity: 1.0 },3000).fadeOut();
Notice the animate() in there. All it does is change the opacity of an object from 1.0 to 1.0 (i.e. do nothing) over the span of 3 seconds. Brilliant.
