Bootstrap template Metronic Set default check Sidebar

Source: Internet
Author: User

In the beginning we get the template page as shown, but in the given template, each page contains the left side of the sidebar code, which when we develop the system, obviously can not do so, not conducive to change, the repeatability is also very large, but if it is placed in a file in a unified inclusion in the words, It's about how to make the sidebar correctly check the link to the current page, instead of manually setting the tab switch.



By looking at the template source code, found a function setsidebarmenuactivelink, in the sidebar selection link, set an ID for each of the links, the code is as follows:

<li class= "Start active open" ><a href= "javascript:;" ><i class= "Icon-home" ></i><span class= "title" > Stock </span><span class= "selected" > </span><span class= "Arrow open" ></span></a><ul class= "sub-menu" ><li class= "" > <a href= "${pagecontext.request.contextpath}/index" id= "gpsj_page" ><i class= "Icon-bar-chart" ></i > Stock Data </a></li><li class= "" ><a href= "${PAGECONTEXT.REQUEST.CONTEXTPATH}/GP/JYFW" id= "Jyfw_ Page "><i class=" Icon-bar-chart "></i> business scope </a></li><li class=" "><a href=" ${ Pagecontext.request.contextpath}/gp/k_line "id=" gp_kline_page "><i class=" Icon-bar-chart "></i> Stock K Line chart </a></li><li class= "" ><a href= "${pagecontext.request.contextpath}/common/hotwords.jsp" Id= "Common_hot_words_page" ><i class= "Icon-bar-chart" ></i> hot search Words </a></li></ul>< /li> 

, and then, when each page loads, add a layout.setsidebarmenuactivelink (' Set ', $ (' #common_hot_words_page '));

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Bootstrap template Metronic Set default check Sidebar

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.