JSFiddle - React, Tailwind, and code Playground

by Chris Menshenin

HTML

<body>
   <div style="position: absolute; top: 0; left: 0; right: 0; height: 2000px; background: url(http://savepic.ru/14659146.png) repeat;"></div>
   </body>

CSS

body {
 
      height: 2000px;
     
    }

JavaScript

/*Schliess den <script> an*/
$(function(){
var didScroll;
var lastScrollTop = 0;
var delta = 5;
var navbarHeight = $('header').outerHeight();

$(window).scroll(function(event){
    didScroll = true;
});

setInterval(function() {
    if (didScroll) {
        hasScrolled();
        didScroll = false;
    }
}, 250);

function hasScrolled() {
    var st = $(this).scrollTop();
    
    // Make sure they scroll more than delta
    if(Math.abs(lastScrollTop - st) <= delta)
        return;
    
    // If they scrolled down and are past the navbar, add class .nav-up.
    // This is necessary so you never see what is "behind" the navbar.
    if (st > lastScrollTop && st > navbarHeight){
        // Scroll Down
        $('header').removeClass('nav-down').addClass('nav-up');
    } else {
        // Scroll Up
        if(st + $(window).height() < $(document).height()) {
            $('header').removeClass('nav-up').addClass('nav-down');
        }
    }
    })
    
    /*60 FPS*/
function disablehover() {
  var body = document.body,
      timer;
  
  window.addEventListener('scroll', function() {
    clearTimeout(timer);
    if(!body.classList.contains('disable-hover')) {
      body.classList.add('disable-hover')
    }
    
    timer = setTimeout(function(){
      body.classList.remove('disable-hover')
    },500);
  }, false);
      
}
    
    lastScrollTop = st;