Scroll Spy

Example

Scroll down to see the menu to highlight the current section and to see example code.

Section 1
Section 2
Section 3

Installation

$ npm i -S storm-scroll-spy

Usage

HTML

JS

Either import and initialise using a named import:

import ScrollSpy from 'storm-scroll-spy';
            
ScrollSpy.init('.js-scroll-spy');

Or async using storm-load.js, add the .standalone file to your project, then initialise using the global name:

Load('/content/js/async/storm-scroll-spy.standalone.js')
.then(() => {
    StormScrollSpy.init('.js-scroll-spy');
});