jQuery等到函数执行完毕

问题描述

| 我正在尝试调用2个函数。第一个功能包括jQuery效果。第二个函数在这种情况下是jQuery效果),但只有在第一个函数执行(并完成)后才能执行。有人可以帮我吗?谢谢! Fox示例:http://jsfiddle.net/fNH2u/1/
function hideSecond(){
    $(\"#second\").hide(\"slow\");
}

$(\"#first\").click(function(){
    hideSecond();
    $(this).hide(\"fast\");
});
和HTML:
<div id=\"first\">
    first
</div>
<div id=\"second\">
    second
</div>
我想调用功能不只是jQuery效果。这只是一个例子。将这两个功能放在一起并不是我真正想要的。     

解决方法

您将需要在此处使用回调。
function hideSecond(callback){
    $(\"#second\").hide(\"slow\",callback);
}

$(\"#first\").click(function(){
    hideSecond(function() {
       $(this).hide(\"slow\");
    });
});
    ,尝试将.animate()与
[complete]
参数中的回调函数一起使用。