Return the horizontal scrollbar position for a <div> element:
The scrollLeft() method sets or returns the horizontal scrollbar position for the selected elements.
Tip: When the scrollbar is on the far left side, the position is 0.
When used to return the position:
This method returns
the horizontal position of the scrollbar for
the FIRST matched element.
When used to set the position:
This method sets the
horizontal position of the scrollbar for ALL matched elements.
Return horizontal scrollbar position:
Set horizontal scrollbar position:
| Parameter | Description |
|---|---|
| position | Specifies the horizontal scrollbar position in pixels |
Set
the horizontal scrollbar position
How to set the horizontal scrollbar position for an element.
Your message has been sent to W3Schools.