The scrollTop method. An element's scrollTop is a measurement of the distance of an element's top to its topmost visible content.
An element's scrollTop is a measurement of the distance of an element's top to its topmost visible content.
When an element content does not generate a vertical scrollbar, then its scrollTop value defaults to 0.
scrollTop can be set to any integer value, however:
- If the element can't be scrolled (e.g. it has no overflow or if the element is non-scrollable), scrollTop is set to 0.
- If set to a value less than 0, scrollTop is set to 0.
- If set to a value greater than the maximum that the content can be scrolled, scrollTop is set to the maximum.
The .scrollTop()
method, in jQuery
is used to get or manipulate the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.
For more on this subject, please refere to the jQuery page, until further updates.