scrollSpy

Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.scroll

This function allows you to add/remove automatically the -active class on some passed links that have a href attribute that points to an element on the page.

Params

  1. settings{}TScrollSpySettings

    The settings you want to override

Example

import { scrollSpy } from '@blackbyte/sugar/scroll';
scrollSpy($myLinks);

Settings

  1. offsetwindow.innerHeight/2number

    The offset you want before adding the classes

  2. activeClass-activestring

    The class name you want to add/remove