开发者

Jquery slidetoggle question

How can I get one script of jQuery 开发者_如何转开发to start after another one has finished (or time it when you want it to start)? I have a content area that fades in on page load:

$(document).ready(function() {

    $("#content").hide();

    $(window).load(function() {
        $("#content").fadeIn(3000);
    });

});

Than, once that fades in I want the nav bar above the content area to slide toggle down. I'm trying to make the scripts act in accordance with the timing of one another. OK, thank you.


Use .fadeIn()'s callback:

$("#content").fadeIn(
    3000,
    function() {
       //do stuff here
    }
);


$(document).ready(function() {

$("#content").hide();

$(window).load(function() {
    $("#content").fadeIn(3000, function() {

       $('#navBar').slideDown('slow')
      });
   });
});

.fadeIn() allows you to specify a function to be called once its complete. is the $(window).load() necessary here with $(document).ready()?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜