Using a mouse wheel works only on vertical scrolling. When scroll list is horizontal, scrolling works only by dragging and clicking the bar.
I'm looking for something exactly like you described. Did you found a workaround for this?
Yes, you can bind regular onWheel event to your scrollbar and then use it like this:
_onMouseWheel: function(event) {
if (this.props.direction === 'horizontal') {
var list = event.currentTarget.firstChild;
var delta = (event.deltaX == 0 ? event.deltaY : event.deltaX);
list.scrollLeft += delta;
event.preventDefault();
}
},
Normally you use deltaY, and deltaX check is for mac trackpad.
I am using this: https://www.npmjs.com/package/normalize-wheel for fixing cross-browser issues.
I use
onMouseWheel(e) {
const currentScrollDelta = this.scrollBars.getScrollLeft();
this.scrollBars.scrollLeft(currentScrollDelta + e.deltaY);
}
I use
onMouseWheel(e) { const currentScrollDelta = this.scrollBars.getScrollLeft(); this.scrollBars.scrollLeft(currentScrollDelta + e.deltaY); }
awesome solve my problem :) thanks
Most helpful comment
I use