I am trying to change the opacity of my navigation bar from lower to higher on scroll. My code is working, only problem is that nav menu items lose their opacity also. I would like them and also the logo to keep the white color and opacity 1 all the time, just want to change the background opacity. Here is my code
HTML
<nav>
<div id='cssmenu'>
<div id="logo">
<a href="#"><img src="images/logo.png" /></a>
</div>
<ul>
<li><a href='#'>Home</a></li>
<li class='active'><a href='#'>Products</a></li>
<li><a href='#'>About</a></li>
<li><a href='#'>Contact</a></li>
</ul>
</div>
</nav>
CSS
#cssmenu {
font-family: Montserrat, sans-serif;
background-color: #09090c;
position: fixed;
width:100%;
background-color:rgba(9, 9, 12, 1);
}
#cssmenu > ul > li {
float: right;
}
#cssmenu img{
float:left;
margin-left:10px;
}
JS
$(document).on('scroll', function (e) {
$('nav').css('opacity', ($(document).scrollTop() / 200));
});