Added a fix for homepage scroll on touch devices
parent
ccfee620fe
commit
7113f66802
|
|
@ -3,15 +3,17 @@ import Scrollbar from 'smooth-scrollbar'
|
||||||
export default class HorizontalScrollPlugin extends Scrollbar.ScrollbarPlugin {
|
export default class HorizontalScrollPlugin extends Scrollbar.ScrollbarPlugin {
|
||||||
static pluginName = 'horizontalScroll';
|
static pluginName = 'horizontalScroll';
|
||||||
transformDelta (delta, fromEvent) {
|
transformDelta (delta, fromEvent) {
|
||||||
console.log(fromEvent.type)
|
const { x, y } = delta
|
||||||
|
if (!this.scrollbar.options.horizontal) {
|
||||||
|
return {
|
||||||
|
y: y,
|
||||||
|
x: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!/wheel/.test(fromEvent.type)) {
|
if (!/wheel/.test(fromEvent.type)) {
|
||||||
return delta
|
return delta
|
||||||
}
|
}
|
||||||
// @see: https://github.com/idiotWu/smooth-scrollbar/issues/181
|
// @see: https://github.com/idiotWu/smooth-scrollbar/issues/181
|
||||||
if (!this.scrollbar.options.horizontal) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const { x, y } = delta
|
|
||||||
return {
|
return {
|
||||||
y: 0,
|
y: 0,
|
||||||
x: Math.abs(x) > Math.abs(y) ? x : y
|
x: Math.abs(x) > Math.abs(y) ? x : y
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue