⊗jsSpMWSGS 27 of 294 menu

Getting and changing a window scroll in JavaScript

The following properties contain how much the window is scrolled:

let t = document.documentElement.scrollTop; // from top let l = document.documentElement.scrollLeft; // from left

These properties can be changed to scroll the window to an arbitrary position:

document.documentElement.scrollTop = 200;

By clicking on the button, scroll the window to the position 300px from the top.

By clicking on the button, scroll the window to the position 100px from the bottom.

On button click, scroll the window to the very top.

On button click, scroll the window to the very bottom.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline