gpt4 book ai didi

jquery - 3 级 metisMenu 元素未扩展回事件选择

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

我将以下 Bootstrap 导航侧边栏与 metisMenu jquery 库一起使用:

<div id="Sidebar" class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li>
<a href="/Dashboard"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
</li>
<li>
<a href='#'>
<i class='fa fa-calendar fa-fw'></i> Diary<span class='glyphicon arrow'></span>
</a>
<ul class='nav nav-second-level'>
<li>
<a href="/Diary/Index?diaryModeId=1">My Actions</a>
</li>

</ul>
</li>
<li>
<a href='#'>
<i class='fa fa-pie-chart fa-fw'></i> MI<span class='glyphicon arrow'></span>
</a>
<ul class='nav nav-second-level'>
<li>
<a href="/MI/EntityStatus">Entity Status</a>
</li>
</ul>
</li>
<li>
<a href='#'>
<i class='fa fa-cogs fa-fw'></i> Administration<span class='glyphicon arrow'></span>
</a>
<ul class='nav nav-second-level'>

<li>
<a href='#'>
Question Admin<span class='fa plus-minus'></span>
</a>
<ul class='nav nav-third-level'>

<li>
<a href="/Rule/Index">Business Rules</a>
</li>
<li>
<a href="/Question/Index">Question Bank</a>
</li>
</ul>
</li>
<li>
<a href='#'>
User Admin<span class='fa plus-minus'></span>
</a>
<ul class='nav nav-third-level'>
<li>
<a href="/User/Index">Users</a>
</li>
<li>
<a href="/Team/Index">Teams</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>

我在刷新时运行以下代码:

$(function () {

$('#side-menu').metisMenu();

});

1 级和 2 级选择在菜单折叠然后重新选择所选菜单选项时工作正常。当我选择 3 级元素(例如问题库)时,菜单会折叠但不会重新选择。还有什么我需要做的吗?我的 html 标记是否正确?

最佳答案

对于三级菜单项(或任何级别的菜单项),您需要确保其所有祖先 li 项都具有 class="active"

关于jquery - 3 级 metisMenu 元素未扩展回事件选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36837743/

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