How about friends, I have an eventHandler added to a div that listens if the user scrolls to hide the navigation bar. It works fine since the container that performs the scroll function is the body, but if I add the overflow: scroll style to the div that contains my sections, the eventHandler doesn't work anymore. How can I add this same code to a div that contains the .layoutContainer class?
useEffect(() => {
window.addEventListener("scroll", handleScroll, { passive: true });
window.addEventListener("touchmove", handleScroll, {
passive: true,
});
}, []);
I tried doing getElementByClassName but it didn´t works. Hope you can help me, thank you