Let’s say I have this markup:
First paragraph
-
I think what you're looking for is using the 'ScrollTo' plugin in jQuery. You can check it out here.
You can specify what to scroll...
$('div.pane').scrollTo(...);//all divs w/class pane
Or just scroll the window:
$.scrollTo(...);//the plugin will take care of this
There are many different ways to specify the target position.
These are:
- A raw number
- A string('44', '100px', '+=30px',
etc )
- A DOM element (logically, child of
the scrollable element)
- A selector, that will be relative to
the scrollable element
- A hash { top:x, left:y }, x and y
can be any kind of number/string
like above.
Bonus:
In digging up this information, I also found LocalScroll and SerialScroll (animates scrolling from one item to the next).