Seeking assistance on creating a scrolling effect for a box shadow property using HTML, CSS, and JS.
The goal is to have the shadow appear with a subtle transition while scrolling and then disappear when scrolling stops.
Here's the code I've been working with:
<head>
<title>website</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<div id="mySidenav" class="sidenav" onscroll="scrollShadow()"></div>
CSS
.sidenav {
height: 100%;
width: 280px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: skyblue;
overflow-x: hidden;
transition: 0.5s;
padding-top: 10px;
}
JS
function scrollShadow() {
document.getElementsByClassName("sidenav").style.boxShadow = "3px 0px 10px black";
}
Any advice or solutions would be greatly appreciated!