【发布时间】:2017-12-31 20:21:27
【问题描述】:
当我remove 一个时,我想为其他div 的“向上移动”添加效果。
这里的html:
<ul id="fds">
<li>
<h3>one</h3>
<p>Hello guys</p>
<p>
<button class="remove">x</button>
</p>
</li>
<li>
<h3>two</h3>
<p>Hello guys</p>
<p>
<button class="remove">x</button>
</p>
</li>
<li>
<h3>three</h3>
<p>Hello guys</p>
<p>
<button class="remove">x</button>
</p>
</li>
<li>
<h3>four</h3>
<p>Hello guys</p>
<p>
<button class="remove">x</button>
</p>
</li>
</ul>
这里是 JavaScript:
$("#fds").delegate(".remove", 'click', function() {
var $li = $(this).closest("li");
$li.fadeOut(300, function() {
$li.remove();
})
})
Here 一个 JS 来测试这个。
【问题讨论】:
-
@Andreas “我想在删除一个 div 时为其他 div 的“上移”添加效果。”。
-
请将正确答案标记为已接受。
标签: javascript jquery effect