1
$(document).ready(function() {
$(".scroll").click(function(e){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
});
});
.menu{background:#ff0;}
.section-1{width:100%;height:100vh;background:#F86;}
.section-2{width:100%;height:100vh;background:#F56;}
.section-3{width:100%;height:100vh;background:#F40;}
<header class="container-top">
<section class="container">
<section class="row">
<section class="col-lg-12">
<nav class="menu col-lg-12">
<ul>
<li><a class="scroll" href="#box1">Seção 1</a></li>
<li><a class="scroll" href="#box2">Seção 2</a></li>
<li><a class="scroll" href="#box3">Seção 3</a></li>
</ul>
</nav>
</section>
</section>
</section>
</header>
<section id="box1" class="section-1">
<section class="container">
<section class="row">
<section class="col-lg-12">
<h1> Seção 1</h1>
</section>
</section>
</section>
</section>
<section id="box2" class="section-2">
<section class="container">
<section class="row">
<section class="col-lg-12">
<h2> Seção 2</h2>
</section>
</section>
</section>
</section>
<section id="box3" class="section-3">
<section class="container">
<section class="row">
<section class="col-lg-12">
<h3> Seção 3</h3>
</section>
</section>
</section>
</section>
Good night,
I am starting in Bootstrap and I am facing some problems, because when I try to use a Jquery effect that works perfectly in other projects(that I don’t use Bootstrap), works perfectly, but this same effect applied in the Bootstrap structure is not working. I would like to know through the experience of colleagues if it is not possible to use it only with Jquery? Because right now I’m facing another problem, I’m trying to make the scroll go down smooth when I click on a link that has an anchorage but this effect does not work in any way. Do you know any tutorial or any way I can make the smooth scroll effect?
dvd found the problem that was preventing my code from working, through your help with your code I did some testing and noticed that the call of jquery that comes with the structure of Bootstrap is preventing the animation effect from working, I switched the call and it worked, below I am leaving the link that accompanies the Bootstrap structure that did not work the animation: <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" Integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgVzpbzo5smXKp4YfRvH+8abtTE1Pi6zo" crossorigin="Anonymous"></script>
– Israel