jquery - MVC4 Sidebar Active Item? -


hello have question using template , has sidebar menu enter image description here

the problem see when click components opening when click grids in it, closing dont want close should stay opened. working when start html in mvc doesn't work. "postback" ? if yes how can solve it. thank .

ok codes

<div id="container" class="row-fluid">     <!-- begin sidebar -->     <div id="sidebar" class="nav-collapse collapse">         <!-- begin sidebar toggler button -->         <div class="sidebar-toggler hidden-phone"></div>         <!-- begin sidebar toggler button -->          <!-- begin responsive quick search form -->         <div class="navbar-inverse">             <form class="navbar-search visible-phone">                 <input type="text" class="search-query" placeholder="search" />             </form>         </div>         <!-- end responsive quick search form -->         <!-- begin sidebar menu -->         <ul class="sidebar-menu">             <li class="has-sub active">                 <a href="javascript:;" class="">                     <span class="icon-box"> <i class="icon-dashboard"></i></span> dashboard                     <span class="arrow"></span>                 </a>                 <ul class="sub">                     <li class="active"><a class="" href="@url.action("about","home")">dashboard 1</a></li>                     <li><a class="" href="@url.action("contact","home")">dashboard 2</a></li>                  </ul>             </li>             <li class="has-sub">                 <a href="javascript:;" class="">                     <span class="icon-box"> <i class="icon-book"></i></span> ui elements                     <span class="arrow"></span>                 </a>                 <ul class="sub">                     <li><a class="" href="@url.action("about","home")">general</a></li>                     <li><a class="" href="@url.action("about","home")">buttons</a></li>                     <li><a class="" href="@url.action("about","home")">jquery ui component</a></li>                     <li><a class="" href="@url.action("about","home")">tabs & accordions</a></li>                     <li><a class="" href="@url.action("about","home")">typography</a></li>                     <li><a class="" href="@url.action("about","home")">tree view</a></li>                     <li><a class="" href="@url.action("about","home")">nestable list</a></li>                 </ul> 

it going ı need write jquery or js think how can reach each li class ?

var activeurl = window.location.pathname;     $('a[href="' + activeurl + '"]').parent('li').addclass('active');     $('a[href="' + activeurl + '"]').parent('li').parent('ul').parent('li').addclass('active'); 

these codes solved problem.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

qml - Is it possible to implement SystemTrayIcon functionality in Qt Quick application -

double exclamation marks in haskell -