jQuery > Manipulations methods

.scrollLeft() - Get & set horizontal scroll position in jQuery

How to get and set the horizontal scroll position of an element in jQuery?


To get and set the current horizontal scroll position of an element, scrollLeft() method can be used.

 <script>
     alert($("#divScroll").scrollLeft());
     $("#divScroll").scrollLeft("100");
  </script>

Above code snippet will first alert the current scroll left position of the element whose id is “divScroll” and then move its horizontal scroll bar position to 100.

 Views: 12309 | Post Order: 56



Write for us






Hosting Recommendations