ilyashubin / scrollbooster

Enjoyable content drag-to-scroll library
https://ilyashubin.github.io/scrollbooster
MIT License
986 stars 81 forks source link

Doesn't work horizontal scrolling on mousewheel #59

Open kubarenatioN opened 3 years ago

kubarenatioN commented 3 years ago

It doesn't work

new ScrollBooster({
    viewport,
    content,
    direction: 'horizontal',
    emulateScroll: true,
    onUpdate: (state) => {
        content.style.transform = `translateX(${-state.position.x}px)`
    }
})

If you use native scrolling, scrolling is handled by browser itself:

new ScrollBooster({
  viewport,
  content,
  direction: 'horizontal',
  onUpdate: (state) => {
    viewport.scrollLeft = state.position.x;
  }
})

Originally posted by @ilyashubin in https://github.com/ilyashubin/scrollbooster/issues/19#issuecomment-570052479

JsFiddle: https://jsfiddle.net/eq3cntow/93/