I would like to log how much the user is scrolling a wrapper.
The following code does not work. I would like to know what am I doing wrong and how to fix it. Thanks!
const content = document.getElementById('content')
const wrapper = document.getElementById('wrapper').addEventListener('scroll', () => {
console.log(content.scrollTop)
})
#wrapper {
background-color: red;
position: absolute;
top: 0;
left: 0;
width: 250px;
height: 250px;
overflow: auto;
}
#content {
position: absolute;
top: 0;
left: 0;
background-color: orange;
width: 50px;
height: 500px;
}
<div id="wrapper">
<div id="content"></div>
</div>