开发者

small jquery script. Easy to do. Animate

开发者 https://www.devze.com 2023-02-12 09:33 出处:网络
I have this script. $(\"#menu li a.nieuwsbriefaanmelden\").click(function() { $(\"#nieuwsbrief\").slid开发者_Go百科eDown(600);

I have this script.

$("#menu li a.nieuwsbriefaanmelden").click(function()
                {
                    $("#nieuwsbrief").slid开发者_Go百科eDown(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


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'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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号