I'm trying to target the scrolling of a div by class or id, but i cannot make it work. The console.log(scrolled) doesn't activate anything in the console. Can someone please help me out?
The JS i use is
document.getElementsByClassName('.site-content').addEventListener('scroll', () => {
const scrolled = document.getElementsByClassName('.site-content').scrollY;
console.log(scrolled);
});
And the CSS for my section is
.site-content{
width:100vh;
height:100vw;
overflow-x: hidden;
overflow-y: scroll;
transform: rotate(-90deg) translateX(-100vh);
transform-origin: top left;
position:absolute;
scrollbar-width:none;
-ms-overflow-style:none;
}
` tag so that it runs once the HTML has loaded (alternative solutions - [Why does jQuery or a DOM method such as getElementById not find the element?](https://stackoverflow.com/a/8716680))
– Nick Parsons Oct 09 '21 at 11:18