Skip to content

Commit

Permalink
Update instructions for v3.1.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmarabeas committed Sep 10, 2014
1 parent 519c54f commit 70c939b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,31 @@

### ng-ScrollSpy is an AngularJS module for navigation highlighting.

Grab it with Bower: `bower install ng-ScrollSpy.js`
Grab it with Bower:

Include it in your AngularJS application
bower install ng-ScrollSpy.js

var myApp = angular.module( 'myApp', [ 'ngScrollSpy' ] );
Include it in your AngularJS application

The following line is your navigation item element which will be given an `active` class when the specified ID is spied upon. It is element type unspecific.
var myApp = angular.module( 'myApp', [ 'ngScrollSpy' ] );

The following line is your navigation item element which will be given an `active` class when the specified ID is spied upon. It is element type unspecific. You can listen for multiple elements with pipe separation.

<span data-scrollspy-listen="myID">myID</span>
<span data-scrollspy-listen="myID">myID</span>
<span data-scrollspy-listen="myID|another">multiple</span>

This is the element you wish to spy on. Offset can be set specifically on elements as well.

This is the element you wish to spy on.
<section id="myID" data-scrollspy-broadcast data-scrollspy-offset="100"></section>

<section id="myID" data-scrollspy-broadcast></section>
There are some global config options available:

myApp.config([ 'scrollspyConfigProvider', function( scrollspyConfigProvider ) {
  scrollspyConfigProvider.config = {
   offset: 250, //offset added to element
   throttle: true, //whether to limit the scroll event to once every n
   delay: 100 //the delay between scroll events
  };
}]);

NOTE: this AngularJS module is simply a scrollspy, anchor linking / smooth scrolling is another modules concern.
11 changes: 8 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,23 @@

<div class="wrapper">

<p>Grab it with Bower:</p>

<code>bower install ng-ScrollSpy.js</code>

<p>Include it in your AngularJS application</p>

<code>var myApp = angular.module( 'myApp', [ 'ngScrollSpy' ] );</code>

<p>The following line is your navigation item element which will be given an `active` class when the specified ID is
spied upon. It is element type unspecific.</p>
spied upon. It is element type unspecific. You can listen for multiple elements with pipe separation.</p>

<code>&lt;span data-scrollspy-listen="myID"&gt;myID&lt;/span&gt;</code>
<code>&lt;span data-scrollspy-listen="myID|another"&gt;multiple&lt;/span&gt;</code>

<p>This is the element you wish to spy on.</p>
<p>This is the element you wish to spy on. Offset can be set specifically on elements as well.</p>

<code>&lt;section id="myID" data-scrollspy-broadcast&gt;&lt;/section&gt;</code>
<code>&lt;section id="myID" data-scrollspy-broadcast data-scrollspy-offset="100"&gt;&lt;/section&gt;</code>

<p>There are some global config options available:</p>

Expand Down

0 comments on commit 70c939b

Please sign in to comment.