🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

nav-scroll-spy

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nav-scroll-spy

Simple Scroll Spy Class

1.0.2
latest
Source
npm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

nav-scroll-spy

Simple ES6 Scroll Spy Class

Example: komock.github.io/nav-scroll-spy

Install

npm i --save-dev nav-scroll-spy

Usage

// Absolute path to module 'node_modules/nav-scroll-spy/src/js/nav-scroll-spy.js'
import NavScrollSpy from 'nav-scroll-spy';
let spy = new NavScrollSpy();
spy.init();

Markup example

<nav>
	<ul>
		<li><a href="#section-1">section-1</a></li>
		<li><a href="#section-2">section-2</a></li>
	</ul>
</nav>

Options

OptionTypeDefaultDescription
offsetnumber0Scroll offset
currentClassstring'active'Element class for current navigation item (or items). Class will be applied to link parent.
selectorstring (html)'nav a[href*="#"]'Selector for navigation links
throttlenumber100Throttling window events (scroll and resize) to improve performance

Features

  • Fast and lightweight
  • No jQuery
  • ES6 ready

FAQs

Package last updated on 19 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts