"Seventh article" Bootstrap 3-level menu style, Support master page left open state

Source: Internet
Author: User

Razor View, master page

Still not much to say, directly on the code

<ulclass= "Sidebar-menu">@for (int i = 0; I<mlist. Count; i++) {if (Mlist[i]. Fatherid== 0) {mclist= Getchild (Mlist[i]. ModuleID,mlist);<!--A collection of level two menus-->                        <Liclass= "TreeView"><ahref="#"><Iclass= "fa fa-folder-o"></I><span>@mList [i]. ModuleName</span><Iclass= "fa fa-angle-left pull-right"></I></a><!--level Menu -                            <ulclass= "Treeview-menu">@for (int j = 0; J<mclist. Count; J + +)//two-level loop {if (Mclist[j]. Fatherid== 41)//If it is CRM, enter this loop {Mslis T= Getchild (Mclist[j]. ModuleID,mlist); <!--A collection of level three menus-->                                    <Li><ahref= "javascript:void (0);"Data-id= "@mCList [j]. ModuleID "><Iclass= "fa fa-share"></I>@mCList [j]. ModuleName<Iclass= "fa fa-angle-left pull-right"></I></a><!--Level Two menu -                                        <ulclass= "Treeview-menu">@for (int k = 0; K<mslist. Count; k++)//Three-level menu loop {if (! String.IsNullOrEmpty (Mslist[k]. Roteurl)) {<li><ahref= "@Url. Content (Mslist[k]. Roteurl) [email protected][k]. ModuleID "Data-id= "@mSList [K]. ModuleID "><Iclass= "fa fa-circle-o"></I>@mSList [K]. ModuleName</a></Li>                                                <!--Level Three menu -i++;                                                } else { <Li><ahref= "javascript:void (0)"Data-id= "@mSList [K]. ModuleID "><Iclass= "fa fa-circle-o"></I>@mSList [K]. ModuleName</a></Li>                                                <!--Level Three menu -i++; }                                            }                                        </ul>                                    </Li>i++;                                        } else//Not CRM then enter this { if (! String.IsNullOrEmpty (Mclist[j]. Roteurl)) {<Li><ahref= "@Url. Content (Mclist[j]. Roteurl) [email protected][j]. ModuleID "Data-id= "@mCList [j]. ModuleID "><Iclass= "fa fa-circle-o"></I>@mCList [j]. ModuleName</a></Li>                                    <!--Level Two menu -i++;                                    } else { <Li><ahref= "javascript:void (0);"Data-id= "@mCList [j]. ModuleID "><Iclass= "fa fa-circle-o"></I>@mCList [j]. ModuleName</a></Li>                                    <!--Level Two menu -i++; }                                    }                                }                            </ul>                        </Li>                        }                    }                </ul>

Here's the point.

$.widget.bridge (' UIButton ', $.ui.button); var_url = $.geturlparam ("CID"); $(". Sidebar-menu li a"). each (function() {//leave the status of the menu open                var_id = $ ( This). Data ("id")); if(_id = =_url) {                    $( This). Parent (). Parent (). Show ();            }            }); $(". Sidebar-menu li a"). Click (function () {                $( This). AddClass (""); })        });

Ways to get Menu parameters

(function($) {$.geturlparam=function(name) {varReg =NewRegExp ("(^|&)" + name + "= ([^&]*) (&|$)");//constructs an object that contains a regular expression of the target parameter        varr = Window.location.search.substr (1). Match (REG);//Match target Parameters        if(r! =NULL) {            returnUnescape (r[2]);//Return parameter Values}Else {            return NULL; }}) (JQuery);

Seventh Bootstrap 3-level menu style, support for master pages left open

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.