0
I’m using the bootstrap and I have a menu, what I wanted was that when I clicked on a link from that menu, I displayed the page and left selected in the menu the page the user is on.
I tried to assign a class using the function .addClass()
when the user clicks on the menu, but when I click until I see that it changes color, however, when the page finishes loading it loses the effect.
My code Javascript this way:
$(document).ready(function() {
$('a.menu').click(function() {
$(this).addClass("style");
});
});
HTML:
<div id="navbar" class="navbar-collapse collapse bloco-menu">
<ul class="nav navbar-nav ">
<li><a class="menu" href="index.html">O Evento</a></li>
<li><a class="menu" href="mensagem-presidente.html">Mensagem da Presidente</a></li>
<li><a class="menu " href="palestrantes.html">Palestrantes</a></li>
<li><a class="menu" href="localizacao.html">Local do Evento</a></li>
<li><a class="menu" href="inscricoes.html">Inscrições</a></li>
<li><a class="menu" href="#contact">Programação</a></li>
<li><a class="menu" href="stands.html">Mapa de stands</a></li>
<li><a class="menu" href="hospedagem.html">Hospedagem</a></li>
<li><a class="menu" href="comissao-organizadora.html">Comissão Organizadora</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
CSS:
.style{color:red;font-weight:bold}
Someone could help me ?
Even removing the style , not working , something is overwriting when the page finishes reloading .
– Lenilson Teixeira
put to add the style on each page... :)
– Marllon Nasser