vue-scrollspy
Scrollspy, and animated scrolt-to, for VueJS
Installation
$ npm install vue-scrollspy --save
Setup
var Vue = ;var Scrollspy = ;Vue
Usage
HTML:
Menu 1 Menu 2 Header 1 Content Header 2 Content
Javascript:
data: scrollPos: 0 { this }
Using the directive creates the global function $scrollSet()
. Call this when the DOM is ready, or when the DOM has changed.
Animated Scroll
For animated scroll, use as follows:
time
in milliseconds, steps
is animation resolution (more steps results in a smoother animation). For non-animated scroll, simply omit these parameters.
TODO
- Add bezier animations
- Add
innerHTML
watcher
(If anybody knows how to watch innerHTML
please let me know.)