我有一个带有span标记的容器,如果我单击span元素,我需要有一个分解动画并删除该元素。
我可以使用淡入淡出效果,但我不确定如何使用爆炸效果,就像这样使用它只是删除没有任何动画:
Css:
#container a span { display:none; background-image:url(images/remove.png); background-repeat:no-repeat; width:16px; height:16px; position:absolute; right:0px; top:0px;}
#container a:hover span { display:block;}
淡出效果:
$('.container a span').live('click', function (e) {
$(this).closest('div.container').fadeOut("normal", function () {
$(this).remove();
});
return false;
});
爆炸效果
$('.container a span').live('click', function (e) {
$(this).closest('div.container').fadeOut("normal", function () {
$(this).hide('explode', { pieces: 25 }, 600);
$(this).remove();
});
return false;
});
这些是动态添加的图像,我绑定的位置如下:
uploader.bind('FileUploaded', function (up, file, res) {
$('#container').append("<div class='container a'><a href='#'><img src='uploads/" + document.getElementById("currentDirectory").value + "/" + file.name + "' width='64' height='64'/><span></span></a></div>");
$('.container a span').live('click', function (e) {
$(this).closest('div.container').fadeOut("normal", function () {
$(this).remove();
});
return false;
});
});
这是我展示图片的地方:
<div id="container">
</div>
发布于 2011-11-09 22:48:12
I think this is what you want?
$('.container a span').live('click', function (e) {
$(this).hide('explode', { "pieces":25 }, 600, function() { $(this).remove; });
return false;
});
https://stackoverflow.com/questions/8072770
复制