removeClass和淡入淡出动画 [英] removeClass and fade animation

查看:113
本文介绍了removeClass和淡入淡出动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码

<ul class="nav sub_nav_home">
    <li id="sub_nav_home1"><a href="#"><span>LINK1</span></a></li>
    <li id="sub_nav_home2"><a href="#"><span>LINK2</span></a></li>
    <li id="sub_nav_home3"><a href="#"><span>LINK3</span></a></li>
</ul>

$("ul.sub_nav_home li").hover(function() {
    $(this).removeClass("current").fadeOut();
});

这似乎没有显示我所追求的动画.这样做是使"li"完全消失.

this doesn't seem to display the animation I was after. What this does is making the "li" to dissapear completely.

基本上,我需要删除具有淡入淡出效果的当前"类,然后将其添加到具有淡入淡出效果的下一个"li"中

Basically what I need is to remove the class "current" with a fade out effect and then add it to the next "li" with a fade in effect

谢谢

推荐答案

不确定是否可以使用直接的jQuery做到这一点,但是我知道jQuery UI具有修改后的removeClass(),它允许您添加一个持续时间来移除 jQuery UI文档

not sure if you can do this with straight jQuery, but I know jQuery UI has a modified removeClass() that lets you add a duration to remove the class over jQuery UI Docs

这篇关于removeClass和淡入淡出动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆