ES6 version of butter.js by BCJdevelopment
https://bcjdevelopment.github.io/butter.js/
-
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 Butter from 'butter-es6'; Butter.init();
-
Butter.cancel();
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,
});
Free and Open Source under the MIT License.