When I click once on one of the options of nav
, it works, but if I double click or if I'm in an area and click to go in another area, it gets lost and buga total, I do not know what to do and I've tried using all possible JS.
HTML:
<nav class="navbar navbar-fixed-top navbar-inverse navbar-transparente ">
<div class="container">
<!-- header -->
<div class="navbar-header">
<!-- botao toggle -->
<button type="button" class="navbar-toggle collapsed"
data-toggle="collapse" data-target="#barra-navegacao">
<span class="sr-only">alternar navegação</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#conteudo-sobre" class="js-scroll-trigger">
<img src="logopng.png" width="100" height="30" style="margin-top: 10px">
</a>
</div>
<!-- navbar -->
<div class="collapse navbar-collapse" id="barra-navegacao">
<ul class="nav navbar-nav navbar-right">
<li><a id="home" href="#conteudo-home">Home</a></li>
<li><a id="sobre" href="#conteudo-sobre">Sobre</a></li>
<li><a id="servicos" href="#conteudo-servicos">Serviços</a></li>
<li><a id="contato" href="#conteudo-contato">Contato</a></li>
<li class="divisor" role="separator"></li>
<li><a id="msc" href="#conteudo-contato">Mande seu currículo</a></li>
</ul>
</div>
</div><!-- /container -->
</nav><!-- /nav -->
<div class="capa " id="conteudo-home">
<div class="texto-capa layer">
<img src="logopng.png" width="450" height="150" >
<h4><hr align="center" width="100" size="1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae pha</h4>
<a href="#conteudo-sobre" class="btn btn-custom btn-branco btn-lg">Saiba mais</a>
</div>
</div>
JQUERY:
$(document).ready(function(){
setBindings();
});
function setBindings() {
$("nav a").click(function(e){
//e.preventDefault();
e.preventDefault();
var sectionID = "conteudo-" + e.currentTarget.id;
$("html body").animate({
scrollTop: $("#" + sectionID).offset().top
}, 1000)
//alert("-" + e.currentTarget.id);
// var sectionID = "conteudo-" e.currentTarget.id;
// alert(sectionID + "id");
/*
$("html body").animate({
scrollTop: $("#" + sectionID).offset().top
},1000)
*/
})
}