JSFiddle - React, Tailwind, and code Playground
HTML
<div class="active"></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
CSS
div {
border: 1px solid gray;
height: 200px;
margin: 30px;
}
div.active { border: 1px dashed red; }
JavaScript
var lastScrollTop = 0;
var isDoingStuff = false;
$(document).scroll(function(event) {
//abandon
if(isDoingStuff) { return; }
if ($(this).scrollTop() > lastScrollTop) {
//console.log('down');
$('.active').removeClass('active').next('div').addClass('active');
isDoingStuff = true;
$('html,body').animate( {scrollTop: $('.active').offset().top }, 1000, function() {
setTimeout(function() {isDoingStuff = false;}, 100);
console.log('off');
});
} else {
//console.log('up');
}
lastScrollTop = $(this).scrollTop();
})