I am definitely a beginner at js,I would like a Transparent Menu and when scrolling down a smooth transition happens from transparent to white with a box shadow.
but the code js doesn't work
<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;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…