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.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

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 11 months ago

Package Health Score

75 / 100
Full package analysis