0
When I click once on one of the options of nav
, it works, but if I double-click or if I’m in one area and click to go to another, it gets lost and Buga total, do not know what to do and I’ve tried to use 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)
*/
})
}
let’s say that it has a Home boot, about and contact, if I am in the home and I click on it goes down quietly, but if I click on it again it goes back home, this should not happen ,
– Gustavo Farias Vila Nova
and when I’m on and I click for contact, it just rolls up out of nowhere,
– Gustavo Farias Vila Nova
exactly!! but unfortunately I’m not getting anywhere at all
– Gustavo Farias Vila Nova
Sure, that would help me a lot
– Gustavo Farias Vila Nova