The only answer I found was still using jquery, and for some reason did not work in my project.
So here is my version, no jQuery needed, enjoy!
Note . Here is a snippet, but since it is embedded, it will delay the event a lot
var lastTimeScrolled = null;
var theElementYouCareAbout = document;
var intervalMilliSeconds = 500;
theElementYouCareAbout.onscroll = function(){
if (performance.now() - lastTimeScrolled > intervalMilliSeconds){
var intervalScroll = setInterval(function(){
if (performance.now() - lastTimeScrolled > intervalMilliSeconds){
doSomething();
clearInterval(intervalScroll);
}
}.bind(intervalScroll).bind(intervalMilliSeconds), 100);
}
lastTimeScrolled = performance.now();
}.bind(intervalMilliSeconds);
function doSomething (){
alert('You just stopped scrolling :)');
}
<div style="height: 200vh">
Scroll me!
</div>
Run codeHide result source
share