A light weight scroll spy library in vanilla js.
$ bower install scroll-spy --save
$ npm install scroll-spy --save
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')