bwsewell / scrollPatrol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scrollPatrol

A replacement for the twitter scrollSpy js plugin

Usage

$("#nav").scrollPatrol();

Or you can specify the amount of padding you want on the top of your dom element you are scrolling to:

$("#nav").scrollPatrol({
  offset: 10
});

Where #nav is the id or class of the <ul> element containg your naviation.

The recommended structure of navigation is:

<ul id="nav">
  <li class="active"><a href="#section-1">Link 1</a></li>
  <li><a href="#section-2">Link 2</a></li>
  <li><a href="#section-3">Link 3</a></li>
</ul>

Navbar links must have resolvable id targets. For example, a <a href="#section-1">Link 1</a> must correspond to something in the dom like <div id="section-1"></div>.

Quirks

All <li> elements should be in the exact same order as their corresponding divs.

Bitdeli Badge

About

License:MIT License


Languages

Language:JavaScript 100.0%