jQuery Event - scroll() Method
Example
Count the number of times the element is scrolled:
$("div").scroll(function() { $("span").text(x+=1); });
Definition and Usage
A scroll event occurs when the user scrolls the specified element.
The scroll event is applicable to all scrollable elements and the window object (browser window).
The scroll() method triggers the scroll event or specifies the function to be executed when the scroll event occurs.
Binds the function to the scroll event
Syntax
$(selector).scroll(function)
Parameters | Description |
---|---|
function | Optional. Specifies the function to be executed when the scroll event occurs. |