Jquery ui 如何将折叠效果与jQuery.remove()结合起来

Jquery ui 如何将折叠效果与jQuery.remove()结合起来,jquery-ui,Jquery Ui,我希望我的div先折叠,然后从DOM中移除。我试过这个,但不是先折叠然后移除,而是立即消失 $("#backgroundPopup").effect("fold", { size: "50%" }, 1000).remove(); //end of effect() 如果我用 $("#backgroundPopup").effect("fold", { size: "50%" }, 1000); 然后它会折叠,但我的div仍然驻留在DOM中。我能把两者结合起来吗 谢谢

我希望我的div先折叠,然后从DOM中移除。我试过这个,但不是先折叠然后移除,而是立即消失

$("#backgroundPopup").effect("fold", {

    size: "50%"

}, 1000).remove(); //end of effect()
如果我用

$("#backgroundPopup").effect("fold", {

    size: "50%"

}, 1000);
然后它会折叠,但我的div仍然驻留在DOM中。我能把两者结合起来吗


谢谢

您想使用
effect
的回调来删除
元素

$("#backgroundPopup").effect("fold", {
    size: "50%"
}, 1000, function(){
    $(this).remove();  // this will run after the effect is finished
});