我有一個運行兩個函數的onclick,我希望第一個函數能夠運行並完成,並在完成時啓動下一個函數。我把它設置像現在這種權利,他們似乎在同一時間運行:有一個功能的jquery在啓動另一個功能之前完成
$("#animate_1").click(function() {
update_1_close();
welcome_open();
});
這是兩個功能,我不想把它們結合在一起,我有這幾條,並結合他們將結束最多是非常複雜的
function update_1_close() {
$("#update_1").animate({
"right": "175px",
"width": "160px"
}, 450);
$("#update_1_caption").animate({
"bottom": "0px"
}, 450);
$("#update_1_img").animate({
"height": "107px",
"width": "160px"
}, 450);
}
function welcome_open() {
$("#welcome_back_1").animate({
"top": "345px"
}, 450);
$("#welcome_header_1").animate({
"top": "35px",
"left": "20px"
}, 450);
$("#welcome").animate({
"height": "270px"
}, 450)
$("#stick_figures").animate({
"top": "215px"
}, 450);
$("#update_1").animate({
"top": "465px",
"right": "175px"
}, 450);
$("#update_2").animate({
"top": "465px"
}, 450);
$("#events").animate({
"top": "645px"
}, 450);
$("#directions").animate({
"top": "645px"
}, 450);
}
你能發佈2函數update_1_close和welcome_open? – Ben