Automatically Scroll Web Pages With jQuery

You’re probably already aware that you can create “anchors” by giving an empty <a> element a name, and then pointing another link to #thename.

But what if you want something a little more…elegant?

The ScrollTo jQuery plugin allows you to make the page scroll to any point on the page, be it an element with a specific ID, an arbitrary screen coordinate, or even a percentage. By default the page will just jump down to the target point, but you can specify a scroll speed parameter in order to make the page actually scroll.

jQuery().scrollTo('#mydiv', 400);

The minified file is tiny, and the functionality is exceedingly useful for pages that have a lot of dynamic elements.