I want my function to fire on scroll, but then wait 250ms until it may fire again.
function myFunction() {
console.log('hello');
}
$(window).on('scroll', function() {
myFunction();
});
I have tried a timeout:
$(window).on('scroll', function() {
setTimeout(function() {
myFunction();
}, 250);
});
However this method delays for 250ms before firing the function.