Skip to content

Angular 4 directive that tracking the scrolling of the document and highligh the navigation link

Notifications You must be signed in to change notification settings

ert78gb/ng-scroll-spy

Repository files navigation

ng-scroll-spy directive

This directive automatically and and remove .active css class to the link base on the document scroll position. The directive use the href tag to find the corresponding HTML element. If the corresponding element close to the top of document that will be .active.

The navigation menu

<nav>
  <ul class="menu" scroll-spy>
    <li>
      <a href="#about">About</a>
    </li>
    <li>
      <a href="#contact">Contact</a>
    </li>
    <li>
      <a href="#other1">Other1</a>
    </li>
  </ul>
</nav>

Somewhere in the content

<h1 id="about">About</h1>
...
<h1 id="contact">Contact</h1>
...
<h1 id="other1">Other1</h1>

About

Angular 4 directive that tracking the scrolling of the document and highligh the navigation link

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •