I made a responsive menu on a one page site.
The page scrolling part is working normally, but the menu only closes if the user clicks on the menu icon again.
I need the menu to close when the user selects one of the nav elements.
$('.efeito-desliza').click(function () {
$('html, body').animate({
scrollTop: $($(this).attr('href')).offset().top
}, 1000);
return false;
});
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Navegação Responsiva</span>
</button>
<a href="#home" class="img-responsive efeito-desliza navbar-brand"><img class="img-responsive"
src="img/logo.png"></a>
</div>
<div id="navbarCollapse" class="menu-scroll collapse navbar-collapse menu">
<ul class="nav navbar-nav ">
<li><a class="efeito-desliza" href="#bu">SOLUÇÕES</a></li>
<li><a class="efeito-desliza" href="#div-quemsomos">QUEM SOMOS</a></li>
<li><a class="efeito-desliza" href="#depoimentos">DEPOIMENTOS</a></li>
<li><a class="efeito-desliza" href="#contato">CONTATO</a></li>
</ul>
</div>
</div>
</nav>