Open In App

jQuery scrollLeft() Method

Last Updated : 31 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The scrollLeft() method is an inbuilt method in jQuery used to return or set the horizontal position of the scroll bar.

Syntax:

$(selector).scrollLeft(position)

Parameters: This method accepts single parameter position which is optional. It is used to specify horizontal scrollbar position in pixels.

Return Value: This method returns the position of the scrollbar.

The below example illustrates the scrollLeft() method in jQuery.

Example 1:

Output:

Example 2:

Output: After clicking on the button position shown by the arrow.

jquery-33


Next Article

Similar Reads