Answers for "detect when scrolling stops"

0

detect when scrolling stops

// Setup isScrolling variable
var isScrolling;

// Listen for scroll events
window.addEventListener('scroll', function ( event ) {

	// Clear our timeout throughout the scroll
	window.clearTimeout( isScrolling );

	// Set a timeout to run after scrolling ends
	isScrolling = setTimeout(function() {

		// Run the callback
		console.log( 'Scrolling has stopped.' );

	}, 66);

}, false);
Posted by: Guest on February-26-2021

Code answers related to "detect when scrolling stops"

Code answers related to "Javascript"

Browse Popular Code Answers by Language