How to use the smooth-scrollbar.get 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 scaccogatto / smooth-vuebar / src / index.js View on Github external
componentUpdated (el, binding) {
        const scrollbar = Scrollbar.get(el)
        if (!scrollbar) return

        // remove old listener, if defined
        const oldListener = bestListener([binding.oldValue, options])
        if (oldListener) scrollbar.removeListener(oldListener)

        // add the new listener, if defined
        const listener = bestListener([binding.value, options])
        if (listener) scrollbar.addListener(listener)

        // refresh
        scrollbar.update()
      },
      unbind (el) {
github Aqro / gooey-hover-codrops / src / js / Tile.js View on Github external
this.fragmentShader = fragmentShader

        this.clock = new THREE.Clock()

        this.mouse = new THREE.Vector2(0, 0)

        this.scroll = 0
        this.prevScroll = 0
        this.delta = 0
        this.hasClicked = false
        this.isZoomed = false

        this.loader = new THREE.TextureLoader()
        this.preload([this.mainImage.src, this.mainImage.dataset.hover, '/dist/img/shape.jpg'], () => { this.initTile() })

        this.Scroll = Scrollbar.get(document.querySelector('.scrollarea'))

        this.bindEvent()
    }
github idiotWu / smooth-scrollbar / __demo__ / scripts / monitor.ts View on Github external
const monitor = document.getElementById('monitor') as HTMLCanvasElement;
const thumb = document.getElementById('thumb') as HTMLCanvasElement;
const track = document.getElementById('track') as HTMLCanvasElement;
const canvas = document.getElementById('chart') as HTMLCanvasElement;
const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
const size = {
  width: 300,
  height: 200,
};

canvas.width = size.width * DPR;
canvas.height = size.height * DPR;
ctx.scale(DPR, DPR);

const scrollbar = Scrollbar.get(document.getElementById('main-scrollbar') as HTMLElement) as Scrollbar;
const monitorCtrl = controller.addFolder('Monitor');

type Coord2d = [number, number];

type RecordPoint = {
  offset: number,
  time: number,
  reduce: number,
  speed: number,
};

type TangentPoint = {
  coord: Coord2d,
  point: RecordPoint,
};
github scaccogatto / smooth-vuebar / src / index.js View on Github external
unbind (el) {
        const scrollbar = Scrollbar.get(el)
        if (scrollbar) scrollbar.destroy()

        el.dispatchEvent(new CustomEvent('unbind', { detail: el }))
      }
    })

smooth-scrollbar

Customize scrollbar in modern browsers with smooth scrolling experience.

MIT
Latest version published 12 days ago

Package Health Score

89 / 100
Full package analysis

Similar packages