vue-scroll-class
A Vue.js directive to add a class to an based on vertical scroll.
Installation
npm i -S vue-scroll-class
Import
;
Add to Vue
Register to Vue globally:
Vue;
Register to a specific Vue instance:
const app = ... directives: 'scroll-class': VueScrollClass ...;
Usage
vue-scroll-class defaults to adding the class 'sticky' to the attached element after the page has been scrolled 100px:
I'll get the class 'sticky' after 100px!
To override these defaults, add a class name or a different number of pixels in the appropriate place:
I'll get the class 'differentClass' after 645px!>