4
I have a partial in Rails to load my header in all pages..
_header.html.erb:
<ul class="nav navbar-nav">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Top Itens!", itens_path %></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> Mais! <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><%= link_to "Sobre", sobre_path %></li>
<li><%= link_to "Privacidade", privacidade_path %></li>
<li><%= link_to "Termos", termos_path %></li>
<li><%= link_to "Contato", contato_path %></li>
</ul>
</li>
</ul>
Jquery:
$('.nav li').click(function() {
$(this).siblings('li').removeClass('active');
$(this).addClass('active');
});
The problem is that every time the page is reloaded, '.Nav li' returns without the active class. How should I proceed?
Ball show worked right! Thank you.
– Vitor Vezani