我有一個項目列表,每個項目都有一個關閉按鈕。點擊後,動畫播放,列表向上滑動,並且項目被成功移除。完成動畫後分離並移動元素
$(document).on("click", ".close-button", function(e) { //removes with animation
$(this).parent().animate({
opacity: 0
}, 250, function() {
$(this).animate({
marginBottom: 0
}, 250)
.children()
.animate({
padding: 0
}, 250)
.wrapInner("<div />")
.children()
.slideUp(250, function() {
$(this).closest(".element").remove();
});
});
});
我試圖使得不是刪除該項目時,我分離的項目,並將其移動到另一個視圖來修改上面的一段代碼。我試圖使用下面的代碼,無濟於事。 $(this).closest('.element').detach().prependTo('#diff-view').hide().slideDown(250)
擺脫動畫將元素成功移動到不同的視圖。
$(document).on("click", ".close-button" ,function(e) { //detaches w/o animation
$(this).closest('.element').detach().prependTo('#diff-view').hide().slideDown(250)
});
我想保持課程的動畫,但我只是無法弄清楚如何,而不是鬆脫,卸下的同時保持他們在的地方。任何幫助將不勝感激。
是刪除工作? – Satpal
@Satpal剛剛評論出來檢查。沒有視覺差異,但我檢查了文檔,顯然它不工作... HTML仍然存在,只是隱藏。我不知道 – moomin