menu

jQuery scrollLeft Method


jQuery .scrollLeft Method : is used to get or set the horizontal scrollbar position of the selected element. .scrollLeft() is used to set or get the scrollbar position. If you want to set position of scrollbar pass value in pixel as input parameter.
We are going to explain both example with demo and example.


jQuery scrollLeft Method Syntax 1 – Get The Position

Syntax for scrollLeft Method –

jQuery scrollLeft() Method Example 1

Below example shows the scrollLfet method get scrollbar position method –

Try it »

jQuery scrollLeft Method 2 – Set The Position

Syntax for set position –

position(px): Pixel position to be scrolled.

jQuery scrollLeft() Method Example 2

Below example will set position 100 from left –

Try it »

Here is output of the example –

jQuery scrollLeft Method