jQuery.event.special.scrollend
The scrollend event is raised when scrolling near the end of the window or scrollable container element.
This is commonly useful for enabling endless scrolling interfaces.
Usage
// handle the 'scrollend' event on an entire document
$(document).on('scrollend', function() {
// handle event
});
// handle the 'scrollend' event of a vertically-overflowing div
$('#SomeOverflowingDiv').on('scrollend', function() {
// handle event
});
// handle the 'scrollend' event on an entire document with custom parameters
$(document).on('scrollend', {
padding: 150, // distance from the top at which 'scrollend' is raised
delay: 250, // frequency to check scroll position during a scroll
initialLoadAttempts: 10, // times `scrollend` is tested for and raised after the page first loads
initialLoadDelay: 1000 // initial load delay
}, function() {
// handle event
});
Tip: When performing an asynchronous request on a scrolltop
or scrollend
event, a flag should be set to block subsequent requests until the current request is complete.