windowscrollBy
Window.scrollBy is a JavaScript method that scrolls the document by a specified amount relative to the current scroll position. It is invoked on the global window object and affects the main browsing context’s scroll position.
The method can be used in two forms. The two-argument form, window.scrollBy(dx, dy), scrolls horizontally by dx
In either form, the function returns undefined. It synchronously updates the document’s scroll position and may
- window.scrollBy(0, 100) scrolls downward by 100 pixels.
- window.scrollBy(-50, 0) scrolls left by 50 pixels.
- window.scrollBy({ left: 0, top: 200, behavior: 'smooth' }) scrolls down smoothly by 200 pixels.
Notes and compatibility: Window.scrollBy is widely supported in modern browsers. The object-form option is not universally