jquery smooth scroll to div code example
Example 1: smooth scroll jquery onclick
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#myDiv").offset().top
}, 2000);
});
Example 2: how to add scroll to div onclick
$("button").click(function() {
$('html,body').animate({
scrollTop: $(".second").offset().top},
'slow');
});