jQuery Tutorial

jQuery scrollLeft() Method With Syntax and Example

What is scrollLeft method in jQuery?

For the selected components, the scrollLeft() method sets or returns the horizontal scrollbar position 

The position of the scrollbar is 0 when it is on the far left side.

When used to revert to the previous position:

This method returns the scrollbar's horizontal position for the FIRST matched element.

When you use it to set the position, it looks like this:

This method adjusts the scrollbar's horizontal position for ALL matched elements.

Syntax of scrollLeft method in jQuery

  • Return the horizontal scrollbar to its previous position:


  • Set horizontal scrollbar position:


Example of jQuery scrollLeft method

For a

element, get the horizontal scrollbar position:
Did you find this article helpful?