.scrollTo()
Categories: UI
.scrollTo( target, [ duration ], [ options ] )Returns: jQuery
Plugin: jQuery.fn.scrollTo
Description: Scroll content of each element in the set of matched elements.
-
.scrollTo( target, [ duration ], [ options ] )
version added: 1.0target A specified target position.
duration A number determining how long the animation will run.
options A map of additional options pass to the method.
Animated scrolling for scrolling elements, or the window itself.
There are many different ways to specify the target position:
- 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
- The string 'max' to scroll to the end.
- A string specifying a percentage to scroll to that part of the container (f.e: 50% goes to to the middle).
- A hash { top:x, left:y }, x and y can be any kind of number/string like above.
Thanks for this great plugin to Ariel Flesler.