JSFiddle - React, Tailwind, and code Playground

by HemalathaThanigaivel

HTML

<div>blah</div>

CSS

div {
    height: 400px;
    background: blue;
}

JavaScript

(function () {
    var previousScroll = 0;
    
    $(window).scroll(function () {
       var currentScroll = $(this).scrollTop();
       if (currentScroll > previousScroll){
           console.log('down');
       }
       else {
          console.log('up');
       }
       previousScroll = currentScroll;
    });
}());