Recently, I've been working on setting up a navbar with buttons that smoothly scroll down to specific sections when clicked. However, as a beginner in jquery, I'm having some trouble figuring out how to make it work seamlessly.
Can anyone guide me on what jquery code I should use to achieve this functionality?
html
<div class="navbar navbar-transparent navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<!-- The button functions as a navigation drop down for phones -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle naviggation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">JEROME REYES</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="#work">Work</a></li>
</ul>
</div>
</div>
js
$(document).ready(function(){
$('a[href^="#"]').click(function(){
$('html , body').animate({
scrollTop:0
},'slow');
})