如何将折叠效果与jQuery.remove()相结合

时间:2012-08-28 13:42:37

标签: jquery-ui

我希望我的div首先折叠然后从DOM中删除。我尝试了这个,但不是先折叠再去掉,而是立刻消失

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

    size: "50%"

}, 1000).remove(); //end of effect()

如果我只是使用

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

    size: "50%"

}, 1000);

然后折叠但我的div仍然存在于DOM中。我可以两者结合吗?

由于

1 个答案:

答案 0 :(得分:0)

您想使用effect回调remove元素。

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