Skip to content

makotot/scrollspy

Repository files navigation

ScrollSpy

npm version bower version DevDependencies License

Scrollspy library.

Demo

http://codepen.io/makotot/pen/YyRXOQ

Installation

npm

$ npm install --save scrollspy-js

bower

$ bower install scrollspy

Usage

<div id="js-scrollspy">
  <ul class="js-scrollspy-nav">
    <li><a href="#internal-link">internal-link</a></li>
    <li><a href="#...">...</a></li>
    <li><a href="#...">...</a></li>
    <li><a href="#...">...</a></li>
  </ul>
  ...
  <div>
    <div id="internal-content"></div>
    ...
  </div>
</div>
...
<script src="./bower_components/scrollspy.js"></script>
var spy = new ScrollSpy('#js-scrollspy', {
  nav: '.js-scrollspy-nav > li > a',
  className: 'is-inview'
});

License

MIT