JavaScript Window scrollBy()
JavaScript Window scrollBy()
The scrollBy() method is used for scrolling the document to the specified number of pixels. This property only works when the document is larger than the screen.
Syntax:-
Its syntax is:- window.scrollBy(x, y) OR scrollBy(x, y)
Further Explanation:-
Parameter | Description |
x | Required. Number of pixels to scroll horizontally. However, negative values scroll to the left while positive values to the right. |
y | Required. Number of pixels to scroll vertically. However, negative values will scroll up while positive values will scroll down. |