So this is the current code I have
$(document).ready(function() {
$(\'.abouta\').click(function(){
$(\'html, body\').animate({scrollTop:308}, \'s
instead of
$('html, body').animate({scrollTop:xxx}, 'slow');
use
$('html, body').animate({scrollTop:$('#div_id').position().top}, 'slow');
this will return the absolute top position of whatever element you select as #div_id
try this
$('#div_id').animate({scrollTop:0}, '500', 'swing');
My solution was the following:
document.getElementById("agent_details").scrollIntoView();
try this:
$('html, body').animate({scrollTop:$('#xxx').position().top}, 'slow');
$('#xxx').focus();
if you want to scroll just only some div, can use the div id instead of 'html, body'
$('html, body').animate(...
use
$('#mydivid').animate(...