


Bootstrap's 3-level menu style supports the implementation method of retaining the open state of the master page
razor view, master page
Still not much to say, just go to the code
<ul class="sidebar-menu"> @for (int i = 0; i < mList.Count; i++) { if (mList[i].FatherID == 0) { mCList = GetChild(mList[i].ModuleId, mList);<!--二级菜单的集合--> <li class="treeview"><a href="#"><i class="fa fa-folder-o"></i><span>@mList[i].ModuleName</span><i class="fa fa-angle-left pull-right"></i></a><!--一级菜单--> <ul class="treeview-menu"> @for (int j = 0; j < mCList.Count; j++) //二级的循环 { if (mCList[j].FatherID == 41) //如果是CRM 则进这个循环 { mSList = GetChild(mCList[j].ModuleId, mList); <!--三级菜单的集合--> <li><a href="javascript:void(0);" data-id="@mCList[j].ModuleId"><i class="fa fa-share"></i>@mCList[j].ModuleName<i class="fa fa-angle-left pull-right"></i></a><!--二级菜单--> <ul class="treeview-menu"> @for (int k = 0; k < mSList.Count; k++) //三级菜单的循环 { if (!String.IsNullOrEmpty(mSList[k].RoteURL)) { <li><a href="@Url.Content(mSList[k].RoteURL)?cid=@mSList[k].ModuleId" data-id="@mSList[k].ModuleId"><i class="fa fa-circle-o"></i>@mSList[k].ModuleName</a></li> <!--三级菜单--> i++; } else { <li><a href="javascript:void(0)" data-id="@mSList[k].ModuleId"><i class="fa fa-circle-o"></i>@mSList[k].ModuleName</a></li> <!--三级菜单--> i++; } } </ul> </li> i++; } else //不是CRM 则进这个 { if (!String.IsNullOrEmpty(mCList[j].RoteURL)) { <li><a href="@Url.Content(mCList[j].RoteURL)?cid=@mCList[j].ModuleId" data-id="@mCList[j].ModuleId"><i class="fa fa-circle-o"></i>@mCList[j].ModuleName</a></li> <!--二级菜单--> i++; } else { <li><a href="javascript:void(0);" data-id="@mCList[j].ModuleId"><i class="fa fa-circle-o"></i>@mCList[j].ModuleName</a></li> <!--二级菜单--> i++; } } } </ul> </li> } } </ul>
Here comes the point
$.widget.bridge('uibutton', $.ui.button); var _url = $.getUrlParam("cid"); $(".sidebar-menu li a").each(function () { //保留菜单打开的状态 var _id = $(this).data("id"); if (_id == _url) { $(this).parent().parent().show(); } }); $(".sidebar-menu li a").click(function () { $(this).addClass(""); }) });
How to get the menu parameters
(function ($) { $.getUrlParam = function (name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式的对象 var r = window.location.search.substr(1).match(reg); //匹配目标参数 if (r != null) { return unescape(r[2]); //返回参数值 } else { return null; } } })(jQuery);
Rendering

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.