scroll-spy
Version:
A light weight scroll spy library in vanilla js
46 lines (27 loc) • 922 B
Markdown
# Scroll-spy [](https://travis-ci.org/forsigner/scroll-spy) [](https://www.npmjs.org/package/scroll-spy)
A light weight scroll spy library in vanilla js.
## Demo
[demo](http://forsigner.com/2016/03/10/fexo-doc-zh-cn/)

## Installation
#### bower
```bash
$ bower install scroll-spy --save
```
#### npm
```bash
$ npm install scroll-spy --save
```
#### Usage
```js
scrollSpy.init({
nodeList: document.querySelectorAll('.link') // require
activeClassName: 'active', // optional , default: active
scrollTarget: document // optional , default: document
});
```
**nodeList** :
- With vanilla js: `document.querySelectorAll('.toc-link')`
- With jQuery: `$('.toc-link')`
## License
[MIT](LICENSE)