JSFiddle - React, Tailwind, and code Playground

HTML

<div class="hey">
  asgasgasg
</div>

CSS

.hey{
  position:absolute;
  top:500px;
  height:300px;
  width:500px;
  background:red;
  display:none;
}
body{
height:5000px;}

JavaScript

$(function(){

    $(window).scroll(function() {
    
      $(".hey").each( function(i){
 var bottomHeader = $(this).offset().top + $(this).height();
 console.log(bottomHeader);
 var bottomWindow = $(window).scrollTop() + $(window).height();

            if( bottomWindow > bottomHeader ){
                $(this).fadeIn(500);
         
            }
            
            });
    });

});