can you tell me why my code doesn't work. I want to call a function when page is scrolled to certain element. (I would like to find solution in vanilla js without using jQuery)
const numberContainer = document.querySelector('.numbers');
window.addEventListener('scroll', () => {
const scrolled = window.scrollY;
const elementPosition = numberContainer.scrollY;
if(scrolled == elementPosition){
counter();
}
})