-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bind MouseWheel to Horizontal Scroll #24
Comments
Hey @MrUltimate, horizontal scroll should be working already, since we take the page size from the If you're experiencing problems please share a code sample/sandbox, and I'll check it this week 🙂 |
Thanks @breadadams, the horizontal scroll works just fine. On mac at least, you have to hold down shift while use the mousewheel to scroll, I was wondering if there's a recommended what to bind the vertical mousewheel scroll, to the horizontal scroll. |
Ah I see, I misunderstood your question. You don't need to perform anything special with useEffect(() => {
// Based on https://stackoverflow.com/a/59680347/2553600
const onWheel = (event) => {
if (!event.deltaY) {
return;
}
document.documentElement.scrollLeft += event.deltaY + event.deltaX;
};
window.addEventListener('wheel', onWheel);
return () => window.removeEventListener('wheel', onWheel);
}, []); |
Hello again,
I would be awesome to have the mousewheel bounding to the horizontal scroll as well. Is there a recommended approach when using
scroll-motion
?Thanks!
The text was updated successfully, but these errors were encountered: