Hello! Tell me, how can I highlight the active menu item in my case? the problem is also in the fact that there is a drop-down list here - it is necessary that when clicking on one of the items, it is highlighted containing it. How can this be implemented?
$('.nav.navbar-nav li a[href="' + window.location.pathname + '"]').parent().addClass('activenav');
.dropdown:hover > .dropdown-menu { display: block; opacity: 0.8; } .dropdown .dropdown-menu { display: block; opacity: 0; -moz-transition: all 800ms ease; -webkit-transition: all 800ms ease; -o-transition: all 800ms ease; -ms-transition: all 800ms ease; transition: all 800ms ease; } .dropdown-menu>li>a { padding: 8px 20px; border-bottom: 1px solid #ccc; } .dropdown-menu>.last>a { border: none; }
<div class="nav-wrapper"> <ul class="nav navbar-nav"> <li class="active"> <a href="../index.php">ГЛАВНАЯ</a> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"></a> <ul class="dropdown-menu"> <li> <a href="../"></a> </li> <li> <a href="../"></a> </li> <li> <a href="../"></a> </li> <li class="last"> <a href="../"></a> </li> </ul> <!-- end dropdown-menu --> </li> </ul> </div>