开发者

Run a method after the other method finished in JQUERY

I have a hide method. What I want is, after this hide method finishes, then the other method will run. How can I do that in Jquery ?

For ex开发者_开发技巧ample

$('.panel').hide(400);

$('.panel2').fadeIn(400);

I want to run second line after the first one finished.

Thanks in advance,


hide method supports callback function parameter:

$('.panel').hide(400, function() { $('.panel2').fadeIn(400); });


$.when(function(){
    $('.panel').hide(400);
}).then(function(){
    $('.panel2').fadeIn(400);
});


$.when(function1()).then(function2());


As shown in the below link, the hide function can have a call back function

http://api.jquery.com/hide/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜