jQuery – wait for animation to end then do something

I have been using jQuery for quite some time now. Following a question on one of the many forums and discussions group I visit daily, I found that not many know that jQuery has a built in way to “listen” for an animation to end and then continue work. For instance, if I am using the slideDown effect, I can create a function that will only execute when the slide is finished.

Wish to know how?

Just like that…

[js]

$(‘div.menuOurHotel’).slideDown(“slow”, function()

{

$(“div.order_form”).hide();

});

[/js]

This is a very useful way to create a responsive intuitive user interface.

Good luck!

Submit to Hacker News

[NOTE] This post has been imported to Hugo from a Wordpress blog. It may be broken, missing images, code snippets or other information.

[NOTE] updated July 12, 2010. It's 3122 days old . This article may have outdated content.