JSFiddle - React, Tailwind, and code Playground
HTML
<div class="bottomMenu"></div>
CSS
body {
height:1600px;
}
.bottomMenu {
top:0;
left:0;
right:0;
position: fixed;
display:none;
height: 60px;
border-top: 1px solid #000;
background: red;
z-index: 1;
}
.bottomMenu.active {
display:block;
}
JavaScript
$(window).scroll(function () {
var y = $(window).scrollTop();
// if above 300 and doesn't have active class yet
if (y > 300 && !$('.bottomMenu').hasClass('active')) {
$('.bottomMenu').addClass('active');
// if below 300 has still has active class
} else if(y <= 300 && $('.bottomMenu').hasClass('active')) {
$('.bottomMenu').removeClass('active');
}
});