Well, I need to create a way to recognize which menu I'm clicking on, I have my index where I call my menus with an include, so I need to put a green bar in the bottom of the menu that is clicked.
How to do this?
<ul class="mainnav">
<li class="active"><a href="principal.php"><i class="icon-dashboard"></i><span>Início</span> </a> </li>
<li class="dropdown"><a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-sort"></i><span>Cadastro</span> <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="listaUsuario.php">Usuários</a></li>
<li><a href="listaPublicacao.php">Publicação</a></li>
<li><a href="#">Clientes</a></li>
<li><a href="#">Paginas Internas</a></li>
</ul>
</li>
<li><a href="cadastroMenu.php"><i class="icon-th-list"></i><span>Menu</span> </a></li>
<li><a href="#"><i class="icon-picture"></i><span>Banner</span> </a> </li>
<li><a href="#"><i class="icon-book"></i><span>Contatos</span> </a> </li>
</ul>
I need only add active
to the li class that is in selection. An example is
Get it done, but it activates the Active in the class, but it gets a few seconds back only to the main marked li, the goal to start the index as Active is for it to appear checked as soon as the site is started, someone has a better idea to solve this problem.
$(function () {
$('.mainnav li').on('click', function(){
$(this).addClass('dropdown active');
$(this).siblings().removeClass('active');
});
});