JSFiddle - React, Tailwind, and code Playground

HTML

<div id="someID">
  Text
</div>

CSS

body {
  height: 700px;
}

#someID {
  margin-top: 300px;
}

.red {
  color: red;
}

JavaScript

$(window).on('scroll', function() {
  $('#someID').addClass('red');
});

$(window).scroll(function() {
  clearTimeout($.data(this, 'scrollTimer'));
  $.data(this, 'scrollTimer', setTimeout(function() {
    $('#someID').removeClass('red');
  }, 250));
});