jquery scroll to element code example
Example 1: scroll to element jquery
$('html, body').animate({
scrollTop: $("#grepperRocks").offset().top
});
Example 2: javascript scroll to element
document.getElementById("divId").scrollIntoView();
Example 3: jquery scroll to element
$("#button").click(function() {
$([document.documentElement, document.body]).animate({
scrollTop: $("#elementtoScrollToID").offset().top
}, 2000);
});