Следите за новинками
в нашем Telegram канале. Жми, чтобы подписаться:)
⊗jsSpMWSE 31 of 294 menu
◀ ▶

Scroll event in JavaScript

There is the scroll event that can be used to catch the moment when the user is scrolling the window. Let's try it:

window.addEventListener('scroll', function() { console.log('!'); });

We will display the current scroll from the top of the site:

window.addEventListener('scroll', function() { console.log(window.pageYOffset); });

When you scroll to the bottom of the page, display a message about it.

← →
↑
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