javascript 淡出/淡入并卷起 jquery 效果
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6429133/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
fade out/fade in and roll up jquery effect
提问by ShaneKm
i have a list of items like so:
我有一个像这样的项目列表:
<ul>
<li><div>some super awesome html here</div></li>
<li><div>another awesome item here</div></li>
....
....
I'm looking for a nice effect to pop/remove the last item on the list and add/fade in a new item on the top after an ajax call. anyone suggestions would be great. thanks.
我正在寻找一种很好的效果来弹出/删除列表中的最后一个项目,并在 ajax 调用后添加/淡入顶部的新项目。任何人的建议都会很棒。谢谢。
EDIT: something more advanced than just simple fade in/out. i've seen it somewhere on the sites where there is a list of 5 items or so and a new item added to the list and old removed with a cool effect.
编辑:比简单的淡入/淡出更先进的东西。我在网站上的某个地方看到过它,那里有一个大约 5 个项目的列表,一个新项目添加到列表中,旧项目删除,效果很酷。
回答by jncraton
jQuery fadeOut()/fadeIn() should do the trick:
jQuery fakeOut()/fadeIn() 应该可以解决问题:
http://api.jquery.com/fadeOut/
http://api.jquery.com/fadeOut/
EDIT:
编辑:
If you want something fancier, slideUp()/slideDown() provide basic sliding animations:
如果你想要更有趣的东西,slideUp()/slideDown() 提供基本的滑动动画:
http://api.jquery.com/slideUp/
http://api.jquery.com/slideUp/
http://api.jquery.com/slideDown/
http://api.jquery.com/slideDown/
There also animate() if you want to add your own animations via changing CSS properties.
如果您想通过更改 CSS 属性添加自己的动画,也可以使用 animate()。