smooth scroll on click jquery code example
Example 1: smooth scroll jquery onclick
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#myDiv").offset().top
}, 2000);
});
Example 2: how to smooth scroll in javascript
window.scrollTo({ top: 900, behavior: 'smooth' })