Skip to main content Accessibility Feedback


Run a callback function after scrolling has stopped.

Works in all modern browsers, and at least back to IE9.

 * Run a callback function after scrolling has stopped
 * (c) 2017 Chris Ferdinandi, MIT License,
 * @param  {Function} callback The function to run after scrolling
var scrollStop = function (callback) {

	// Make sure a valid callback was provided
	if (!callback || typeof callback !== 'function') return;

	// Setup scrolling variable
	var isScrolling;

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

		// Clear our timeout throughout the scroll

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

			// Run the callback

		}, 66);

	}, false);