I want to call a function right after a scroll ends. I have tried a load of different things, none of which have quite worked, and then I came upon this solution in
The jQuery throttle/debounce plugin is perfect for this. Use at_begin = false to execute the callback at the end.
at_begin = false
var scrollEnded = $.debounce(500, false, function () { console.log('scroll ended'); }); $('#scrollableDiv').scroll(scrollEnded);
Demo