JSFiddle - React, Tailwind, and code Playground
HTML
<div id="header-wrap">
</div>
<div id="container">
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</div>
CSS
#header-wrap {
position: fixed;
height: 100px;
top: 0;
width: 100%;
z-index: 100;
background-color:blue;
}
#container{
margin-top: 100px;
}
JavaScript
$(window).scroll(function() {
if($(this).scrollTop() == 0)
$('#header-wrap').css('opacity','1');
else
$('#header-wrap').css('opacity','.4');
});