jQuery event order and waiting till animation complete
问题 I have an slider animation but on clX.click event #close div hides before it is animated -250px left. How to wait till the animation completes and then hide #close div? $(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({