I use standart twitter bootstrap menu:
<ul class="nav nav-pills">
<li><a href="#">...</a></li>
<li><a href="#">...</a></li>
</ul>
How to mark active menu item?
I use standart twitter bootstrap menu:
<ul class="nav nav-pills">
<li><a href="#">...</a></li>
<li><a href="#">...</a></li>
</ul>
How to mark active menu item?
您只需要在您的 li 中添加“活动”,例如:
<li class="active">
<a href="#"></a>
</li>
添加一个类active
到li
var storedListItem = sessionStorage.getItem('selectedListItem');
$("ul.nav > li > a:eq("+(storedListItem)+")").addClass("active");
$("ul.nav > li").on("click",function(){
var index = $(this).index('ul.nav > li');
var selectedListItem = index;
sessionStorage.setItem('selectedListItem', JSON.stringify(selectedListItem));
});