Jquery 在对悬停状态使用淡入淡出时,如何保持活动的subnav可见

Jquery 在对悬停状态使用淡入淡出时,如何保持活动的subnav可见,jquery,menu,fadein,fadeout,nav,Jquery,Menu,Fadein,Fadeout,Nav,我被一些jquery卡住了,在那里我为sub-nav的悬停状态设置了fadeIn和fadeOut 我的不足之处在于,一旦您将鼠标悬停在活动状态上/关闭,副导航将淡出,但我希望它保持可见 jquery: $("ul#main-nav li").hover(function() { //Hover over event on list item $(this).find("span").fadeIn("slow"); //Show the subnav } , function() { //

我被一些jquery卡住了,在那里我为sub-nav的悬停状态设置了fadeIn和fadeOut

我的不足之处在于,一旦您将鼠标悬停在活动状态上/关闭,副导航将淡出,但我希望它保持可见

jquery:

$("ul#main-nav li").hover(function() { //Hover over event on list item
$(this).find("span").fadeIn("slow"); //Show the subnav
    } , function() { //on hover out...
$(this).find("span").fadeOut("slow"); //Hide the subnav
我在JF上的代码如下:


如果是活动项,则退出淡出:

$("ul#main-nav li").hover(function() { //Hover over event on list item
    $(this).find("span").fadeIn("slow"); //Show the subnav
}, function() { //on hover out...
    if($(this).hasClass('active')) {
          return;   
    }
    $(this).find("span").fadeOut("slow"); //Hide the subnav
});

如果是活动项,则退出淡出:

$("ul#main-nav li").hover(function() { //Hover over event on list item
    $(this).find("span").fadeIn("slow"); //Show the subnav
}, function() { //on hover out...
    if($(this).hasClass('active')) {
          return;   
    }
    $(this).find("span").fadeOut("slow"); //Hide the subnav
});

这正是我所需要的!谢谢你,迪奥多斯!这正是我所需要的!谢谢你,迪奥多斯!