Issue
I am facing an issue with a horizontally scrollable element (using overflow-x: scroll;
). When I hover over the element and use the mouse wheel to scroll vertically, nothing happens because the scrollable element captures the mousewheel event.
My goal is to have the mouse wheel scrolling on that element to actually scroll the window up/down instead of being captured by the scrollable element.
Potential Solutions
One approach I attempted was using the wheel
event and preventing the default action for vertical scrolling, but it had no effect.
Another idea involved capturing the deltaY
value from the scroll
event and manually scrolling the window using window.scrollTo()
. However, I am concerned that different browsers and operating systems may handle scrolling differently, making it difficult to replicate the behavior consistently across all platforms.
A last resort option would be implementing the scroll behavior manually with a specialized scrolling library rather than relying on browser functionality.
Question
Is there a way to somehow pass on the wheel event to the parent (window) in this scenario?