loading...

re: Divert Vertical Scroll To The Side ↔️ VIEW POST

FULL DISCUSSION
 

You have to let the default behaviour for the user who scroll with shift to not lose the scroll inertia

scrollableElement.addEventListener('wheel', (ev) => {
  if (!ev.shiftKey) {
    ev.preventDefault();
    scrollableElement.scrollLeft += ev.deltaY + ev.deltaX;
  }
});

Also when you scroll horizontally on a laptop trackpad, the shiftKey will be set to true.

Code of Conduct Report abuse