gpt4 book ai didi

jquery - 左导航折叠,即使当前?

转载 作者:行者123 更新时间:2023-11-28 12:25:02 24 4
gpt4 key购买 nike

我有一个带有悬停动画的左侧导航 - 你可以在这里看到它: http://www.wearewebstars.dk/frontend/test/boerneunivers2.html

如果您例如:单击第二个导航项,则“li”获得一个类:current - 但是当离开“li”项时,它会崩溃 - 这样做是因为一些 javascript,但它不应该那样做os “当前” LI。在脚本中,只有当 LI 不是当前的 LI 时,我的悬停功能才会被触发 - 请在此处查看我的脚本:

$(".left-navigation ul li:not(.current)").hover(function( e ){

var mEnt = e.type=="mouseenter"; // boolean true/false
//alert(mEnt);

$(this).stop().animate({width: mEnt?'95%':35}, mEnt?100:0, function() {
$(this).find("span.nav-text").css({
display: mEnt? "inline-block" : "none"
});
});

});

最佳答案

您的选择器应如下所示:

$(".left-navigation ul li:not('.current')")

我认为这是不言自明的;)

编辑:尝试这样做:

$(".left-navigation ul li:not(.current)").hover(function(){
//mouseenter
},function(){
//mouseout
});

关于jquery - 左导航折叠,即使当前?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18607649/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com