How to use the smooth-scrollbar.ScrollbarPlugin function in smooth-scrollbar

To help you get started, we’ve selected a few smooth-scrollbar examples, based on popular ways it is used in public projects.

github Aqro / gooey-hover-codrops / src / js / utils / HorizontalScrollPlugin.js View on Github external
import Scrollbar from 'smooth-scrollbar'

export default class HorizontalScrollPlugin extends Scrollbar.ScrollbarPlugin {

    transformDelta(delta, fromEvent) {
        if (this.shouldInvertDelta(fromEvent)) {
            return {
                x: delta.y,
                y: delta.y,
            }
        }

        return delta
    }

    shouldInvertDelta(fromEvent) {
        return this.options.events.some((rule) => fromEvent.type.match(rule))
    }

smooth-scrollbar

Customize scrollbar in modern browsers with smooth scrolling experience.

MIT
Latest version published 9 days ago

Package Health Score

89 / 100
Full package analysis

Similar packages