JSFiddle - React, Tailwind, and code Playground
HTML
<div class="navigation red">adsa</div>
CSS
.navigation {
height:800px;
}
.navigation.red {
background:red;
}
.navigation.blue {
background:blue;
}
JavaScript
$(window).scroll(function () {
var windowY = 100;
var scrolledY = $(window).scrollTop();
console.log(scrolledY + " - " +windowY);
if (scrolledY > windowY) {
$('.navigation').addClass;
}
else {
$('.navigation').removeClass("blue");
$('.navigation').addClass("red");
}
});