JSFiddle - React, Tailwind, and code Playground
HTML
<div class='sidebar'>
sidebar
</div>
<div class='footer'>
footer
</div>
CSS
.sidebar {
position: fixed;
top: 0;
background-color: green;
padding: 10px;
color: white;
width: 300px;
height: 400px;
}
.footer {
margin-top: 1200px;
width: 100%;
height: 620px;
background-color: gray;
}
JavaScript
var altura = $(document).height() - $(".footer").height();
$(window).scroll(function(){
if ($(this).scrollTop() > altura){
$(".sidebar").fadeOut(500);
}else{
$(".sidebar").fadeIn(500);
}
});