Reputation: 14773
i have a long scrolling page with lots of divs, one below the other. i would like to scroll automatically when you visit (or reload) the site to scroll from top to a specific div near of the bottom. to jump there isnt a problem, but i want the "scroll" effect. ive checked out scrollTo() but i dont get it to work. my first attempt was something like
$(document).ready(function () {
$.scrollTo('#div5'); });
but it doesnt fire anything. a little bit help needed :) thanks
Upvotes: 0
Views: 419
Reputation: 193261
Try this:
$('html, body').animate({
scrollTop: $('#div5').offset().top
}, 500);
Upvotes: 1