0

I have this script.

$("#menu li a.nieuwsbriefaanmelden").click(function()
                {
                    $("#nieuwsbrief").slideDown(600);
                    $("#nieuwsbrief form").fadeIn(600);
                });

How can i change this script. That the script do first the slidedown. And when the slidedown is done, than he does the fadein. Now the slideshow and fadein effect. Start the same time.

Thanks

Mike
  • 175
  • 2
  • 2
  • 9

2 Answers2

2

Every animation function in jQuery supports callback function as a second argument that is fired once the animation is complete. Thus, you can chain animations like this to have them execute one after another:

$("#menu li a.nieuwsbriefaanmelden").click(function() {
    $("#nieuwsbrief").slideDown(600, function() {;
         $("#nieuwsbrief form").fadeIn(600);
     });
});
Tatu Ulmanen
  • 123,288
  • 34
  • 187
  • 185
0

Tatu Ulmanen's Answer is perfect for simple examples. If you want to get more complicated, and have more effects queued up, take a look at jQuery API - .queue() and a good overview of .queue() (also on Stack Overflow).

Community
  • 1
  • 1
Adam
  • 5,091
  • 5
  • 32
  • 49