Languages
[Edit]
EN

JavaScript - get div scroll left

0 points
Created by:
Hayley-Mooney
677

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

Quick solution:

 

Practical example

Edit

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

References

Edit
  1. Element.scrollLeft - Web APIs | MDN

Alternative titles

  1. JavaScript - get div element scrollX
  2. JavaScript - get div element scrollLeft 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