Javascript 在jQuery和wordpress中删除图像时添加动画

Javascript 在jQuery和wordpress中删除图像时添加动画,javascript,jquery,wordpress,Javascript,Jquery,Wordpress,我有一个画廊,里面有最喜欢的图片或用户,用户可以通过点击“删除”来删除他们不喜欢的图片。删除图像后,将显示下一个图像以代替删除的图像。我想添加一些动画,使其看起来像是下一个图像滑入 我使用以下代码显示和删除页面中的图像 setTimeout(function(){ g(".justified-image-grid").css({opacity:1}); },500); } g(document).ready(function(){ fillFav(); g(".fav_icon").live('

我有一个画廊,里面有最喜欢的图片或用户,用户可以通过点击“删除”来删除他们不喜欢的图片。删除图像后,将显示下一个图像以代替删除的图像。我想添加一些动画,使其看起来像是下一个图像滑入

我使用以下代码显示和删除页面中的图像

setTimeout(function(){ g(".justified-image-grid").css({opacity:1}); },500);
}
g(document).ready(function(){
fillFav();
g(".fav_icon").live('click',function(){
var id2 = g(this).attr("id");
if(id2 == 2) {   
var url = window.location.href;
var data = g(this).attr('data');
var itemtoRemove = data;
imgs.splice(g.inArray(itemtoRemove, imgs),1);
var th = g(this); th.addClass("proce");
th.parent(".jig-imageContainer").css({'opacity':.6});
g.ajax({url:url,method:'GET',data:{'did':data}}).done(function(data){
th.attr("id","1"); th.parent(".jig-imageContainer").remove(); th.html(data); });
}

});

g("#jig1-filterButtons").live('click',function(){
 g(".justified-image-grid").css({opacity:0});
 setTimeout(function(){ fillFav(); },100);
});
});

提前谢谢

您可能想试试这个

用于淡出和删除

th.parent(".jig-imageContainer").hide('slow', function(){ th.parent(".jig-imageContainer").remove() });
用于淡入和添加HTML:

display:none
样式添加到要附加的html中。然后试试这个:

th.html(data).fadeIn('slow');