scroll-spy
v1.0.3
Published
A light weight scroll spy library in vanilla js
Downloads
416
Maintainers
Readme
Scroll-spy
A light weight scroll spy library in vanilla js.
Demo
Installation
bower
$ bower install scroll-spy --save
npm
$ npm install scroll-spy --save
Usage
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')