Scrolls the document in the window by the given amount.
window.scrollBy(x-coord, y-coord); window.scrollBy(options)
x-coordis the horizontal pixel value that you want to scroll by.
y-coordis the vertical pixel value that you want to scroll by.
- or -
optionsis an object with three possible properties:
top, which is the same as the
left, which is the same as the
behavior, which is a string containing one of
auto; default is
// scroll down one page window.scrollBy(0, window.innerHeight);
To scroll up:
|CSS Object Model (CSSOM) View Module
The definition of 'window.scrollBy()' in that specification.
|Working Draft||Initial definition.|
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.