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 2 years ago

Package Health Score

61 / 100
Full package analysis