butter-es6

1.0.2 • Public • Published

butter-es6

Momentum scrolling JS library

ES6 version of butter.js by BCJdevelopment


Demo

https://bcjdevelopment.github.io/butter.js/


Installation & Usage

  • Install the package

    npm install butter-es6
    
  • Create a content wrapper with an id of "butter" (keep fixed html elements outside of content wrapper):

    <div id="butter">
      Put web page content here...
    </div>
  • Import & Initialize Butter

    import Butter from 'butter-es6';
    
    Butter.init();
  • Call butter.cancel() to disable momentum scrolling

    Butter.cancel();

Options

Option default description
wrapperId 'butter' The id of the content wrapper
wrapperDamper 0.07 Changes speed of scroll (increase to speed scroll up)
cancelOnTouch false If true, calls butter.cancel() when touch event occurs

NOTE: It is recommended to set cancelOnTouch to true to avoid scrolljacking on mobile devices since they intrinsically support momentum scrolling.

Butter.init({
  cancelOnTouch: true,
  wrapperDamper: 0.05,
});

License

Free and Open Source under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i butter-es6

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

5.26 kB

Total Files

3

Last publish

Collaborators

  • butadpj