I'm in the process of developing a landing page website where my navigation links smoothly scroll to different sections on the page. Currently, when I click on a nav link, it instantly takes me to the bottom and then back to the top. However, I want to add jQuery animation to make this scrolling effect slow and smooth. Please take a look at my code snippet below and let me know if you see any errors or improvements that can be made. Thank you.
// Smooth Scrolling nav links
$('a[href^="#"]').on('click', function(event) {
var target = $( $(this).attr('href') );
if( target.length ) {
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top,
scrollBottom: target.offset().bottom
}, 1000);
} });