Reputation: 315
I have a div with id=now, this div is empty and do not have any css property (no width, no height, just a hidden div). I want when browser finish load the page, then scroll to this div immediately. User do not need to click on some thing.
Here is my html
<html>
<div>Long div Lorem ipsum</div>
<div id="now"></div>
<div>Long div Lorem ipsum</div>
How to do this with jquery ?
Upvotes: 3
Views: 15518
Reputation: 550
$(function() { // when the DOM is ready...
// Move the window's scrollTop to the offset position of #now
$(window).scrollTop($('#now').offset().top);
});
Upvotes: 12