Skip to content

Instantly share code, notes, and snippets.

@JakubBlaha
Created August 20, 2021 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JakubBlaha/5a1c033fba858ef17d390e1e43bddc22 to your computer and use it in GitHub Desktop.
Save JakubBlaha/5a1c033fba858ef17d390e1e43bddc22 to your computer and use it in GitHub Desktop.
Svelte horizontal wheel scroll action
export const horizontalWheelScroll = (node: HTMLElement) => {
node.style.scrollBehavior = "smooth";
node.addEventListener("wheel", (evt) => {
evt.preventDefault();
node.scrollLeft += evt.deltaY;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment