Scroll to specific div on page load
html, jquery, scroll
Solution
You can do this using the `.animate()` method:
$(document).ready(function () {
// Handler for .ready() called.
$('html, body').animate({
scrollTop: $('#what').offset().top
}, 'slow');
});
- This will smooth scroll to the div with ID `what`
FIDDLE
Problem
I'm trying to figure out how get the page automaticlly scroll to a specific div when the page has loaded. I have tried using the jQuery scroll function, but cant get it to work correctly. Any suggestions? Following is what i have tried so far: ``` jQuery(function() { jQuery(window).scrollTop(jQuery('.container').offset().top); }); ```