Languages
[Edit]
EN

JavaScript - get div scroll top

0 points
Created by:
JoanneSenior
1070

In this article, we would like to show you how to get the div element scrollTop property using JavaScript.

Quick solution:

 

Practical example

Edit

In this example, we get the handle to scrollContainer element, then we use scrollTop property to get the number of pixels that an element's content is scrolled vertically. The value of scrollTop property is displayed as the output element textContent.

See also

Edit
  1. JavaScript - scroll to top page after page refresh

References

Edit
  1. Element.scrollTop - Web APIs | MDN

Alternative titles

  1. JavaScript - get div element scrollY
  2. JavaScript - get div element scrollTop property
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join