7
我有一個滑塊動畫,但在clX.click事件#close div之前隱藏動畫-250px左側。如何等待動畫完成,然後隱藏#close div?jQuery事件順序,並等待動畫完成
$(document).ready(function() {
$("#open").click(function() {
if ($("#close").is(":hidden")) {
$("#open").animate({
marginLeft: "-32px"
}, 200);
$("#close").show();
$("#close").animate({
marginLeft: "250px"
}, 500);
}
});
$("#clX").click(function() {
$("#close").animate({
marginLeft: "-250px"
}, 500);
$("#open").animate({
marginLeft: "0px"
}, 200);
$("#close").hide();
});
});
換句話說:你不等待,您指示動畫做別的東西的時候,它的完成。 – 2010-03-09 08:52:04
完成!但$ this.hide();不能正常工作。 – 2010-03-09 08:59:21