xxxxxxxxxx
$(window).scroll(function (event) {
// Do something when the page is scrolled
}
xxxxxxxxxx
$(window).scroll(function() {
// Add your code here to handle the scrolling event
// This code will be executed every time the window is scrolled
});
xxxxxxxxxx
$(window).on('scroll', function() {
// Perform the desired action here
console.log('Scroll event triggered');
});
xxxxxxxxxx
$( "#target" ).scroll(function() {
$( "#log" ).append( "<div>Handler for .scroll() called.</div>" );
});
xxxxxxxxxx
Syntax
Trigger the scroll event for the selected elements:
$(selector).scroll()
Attach a function to the scroll event:
$(selector).scroll(function)