I consider myself a novice when it comes to JavaScript. My goal is to create a Transparent Menu that smoothly transitions from transparent to white with a box shadow as I scroll down the page. However, the JavaScript code I have implemented does not seem to be working.
<script type="text/javascript">
var a=document.getElementById('play');
var x=window.pageYOffset;
var see =function () {
if (x >30) {
a.style.background=" white";
}else{
a.style.background="transparent";
}
window.addEventListener("onscroll",see);
}
</script>
<header>
<div class="menu" id='a'>
<ul>
<li><b>About</b></li>
</ul>
</div>
</header>
.menu {
background: transparent;
margin-left: 320px;
text-align: center;
width: 100%;
padding: 20px;
position: fixed;
top: 0px;
transition: .5s;
}