JSFiddle - React, Tailwind, and code Playground
by Neeraj Yadav
HTML
<body style="background:red;height:1000px"></body>
JavaScript
var fired = 0;
$.fn.scrollStopped = function(callback) {
$(this).scroll(function() {
if (fired == 0) {
var self = this,
$this = $(self);
if ($this.data('scrollTimeout')) {
clearTimeout($this.data('scrollTimeout'));
}
$this.data('scrollTimeout', setTimeout(callback, 300, self));
fired = 1;
}
});
};
$(window).scrollStopped(function() {
alert("me scrolleed");
fired = 0;
})