THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

jQuery scrollstart Event

jQuery Mobile Events jQuery Mobile Events

Example

Alert some text when a user starts to scroll the page:

$(document).on("scrollstart",function(){
  alert("Started scrolling!");
});
Try it Yourself »

Definition and Usage

The scrollstart event is triggered when the user starts to scroll the page.

Note: iOS devices freeze DOM manipulation during scrolls, which means that it is not possible to change something when the user scrolls. However, the jQuery team are working on a solution for this.

Tip: This event is often attached to the document.

Tip: The scrollstop event is triggered when the user stops to scroll the page.


Syntax

$("selector").on("scrollstart",function(event){...})

Parameter Description
function(event) Required. Specifies the function to run when the scrollstart event occurs

The function has an optional event object, which can contain any jQuery event properties (e.g. event.target, event.type, etc.) See jQuery Events Reference for more information.

Examples

Try it Yourself - Examples

Count scroll starts
Count the number of times the scrollstart event occurs.

The event object
Using the event.target property to return which DOM element that triggered the scrollstart event.


jQuery Mobile Events jQuery Mobile Events