对于动态添加到列表的列表项,突出显示,然后淡出突出显示
我的页面上有一个无序列表。当通过 Ajax 刷新该页面时,可能会返回新的列表项,并将其动态添加到无序列表中。当添加新的列表项时,我想突出显示这些新的列表项,但在指定时间后淡出突出显示。
我尝试过 animate 和 jquery 高亮效果,但没有找到正确的组合来获得所需的结果。我现在正在做的,是在动态添加列表项后调用一个函数来尝试添加突出显示类,然后删除该类,但这也不起作用。
列表项通过 PHP 生成并添加到无序列表中。
在将新列表项动态添加到无序列表后,如何动态突出显示新列表项,然后淡出该突出显示?
我正在寻找的期望结果类似于 Scoopler 的 twitter feed 的行为,链接文本
I have an unordered list on a page. When that page is refreshed through Ajax, new list items may come back that will be dynamically added to the unordered list. When the new list items get added, I would like to highlight those new list items, but fade the highlight out after a specified time.
I have tried animate and the jquery highlight effect, but have not found the right mixture to get a desired result. What I am doing now, is to call a function after dynamically adding the list item to try to add a highlight class, and then remove that class, but that is not working as well.
The list items are generated and added to the unordered list through PHP.
How would I go about dynamically highlighting new list items after they have been dynamically added to an unordered list, but then fade that highlight out?
The desired result I am looking for is similar to how Scoopler's twitter feed behaves, link text
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
经过测试,我认为这符合您的要求(即,它使显示保持 3 秒,然后给出 3 秒的淡出。
Tested, I think this does what you want (that is, it holds the display for 3 seconds, and then gives a 3 second fadeout.
jQuery livequery插件+高亮效果怎么样(假设所有li都在ul中,id为ulcontainer)。沿着这条线的东西应该有效。
How about jQuery livequery plugin + highlight effect (assuming all li's in ul with id ulcontainer). Something along this lines should work.
将其作为两步顺序动画如何?
1) 突出显示动画
2) 设置淡出动画
按顺序而不是并行执行此操作。
How about doing it as a two-step sequential animation.
1) Animate the highlight
2) Animate the fade-out
Do this in a sequence instead of in parallel.