0.0.2 • Published 7 years ago

custom-scrollbar v0.0.2

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

custom-scrollbar

This is fork of perfect-scrollbar. All settings are same. Documentation you can read here.

Install

$ npm install custom-scrollbar
var Cs = require('custom-scrollbar');

Difference

This package has no custom events like ps-scroll-y etc. But has callbacks that can give for developers more information about current state.

onScrollY

Run when the y-axis is scrolled in either direction.

onScrollX

Run when the x-axis is scrolled in either direction.

onScrollUp

Run when scrolling upwards.

onScrollDown

Run when scrolling downwards.

onScrollLeft

Run when scrolling to the left.

onScrollRight

Run when scrolling to the right.

onStartY

Run when scrolling reaches the start of the y-axis.

onEndY

Run when scrolling reaches the end of the y-axis (useful for infinite scroll).

onStartX

Run when scrolling reaches the start of the x-axis.

onEndX

Run when scrolling reaches the end of the x-axis.

You can pass callbacks in settings

Ps.initialize(container, {
  onScrollY: function(value, instance) {
    // value - scroll value
	 // instance - instance of current scrollbar
  }
});

or with jQuery

$('.some').perfectScrollbar({
	onScrollY: function(value, instance) {
	  // value - scroll value
	  // instance - instance of current scrollbar
	}
})