JSFiddle - React, Tailwind, and code Playground

HTML

<h1 id="verschwinden">verschwinden</h1>
<div id="vh">My Height is 100vh</div>

CSS

*{margin:0;}
body{height:3000px;}
#verschwinden{position:fixed; top:0;right:0;}
#vh{background:gold; height:100vh;}

.doch{background:#f0f;}

JavaScript

jQuery(function($) {

    var $nav = $('#verschwinden'),
        $win = $(window),
        winH = $win.height();    // Get the window height.

    $win.on("scroll", function () {
       $nav.toggleClass("doch", $(this).scrollTop() > winH );
    }).on("resize", function(){ // If the user resizes the window
       winH = $(this).height(); // you'll need the new height value
    });

});