我正在尝试让一些 div 淡出然后被删除。
$("article.articles .thumb a").click(function() {
$(this).parent().parent().addClass("selected");
$("article.post").not(".selected").fadeOut(500).delay(1500).remove();
$('#stream').isotope('reLayout');
});
但是 div 会立即被删除而不会褪色。
我做错了什么?
最佳答案
您可以使用fadeOut()
回调函数,该函数在淡入淡出效果完成后执行。
.fadeOut( [duration] [, callback] )
$("article.post").not(".selected").fadeOut(500, function(){
$(this).remove();
})
或者:
$("article.post").not(".selected").fadeOut(500).delay(2000).queue(function(){
$(this).remove()
})
关于jquery - 试图让一些 div 淡出然后被删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11480177/