PureJS_OnePageNav

The PureJS_OnePageNav library is designed to dynamically manage states of navigation links based on scroll offset. It comes with several options that allow customize page navigation working as intended.

Main functionalities:

Getting Started

Installation

npm install purejs_onepagenav

Check out the demo

Find more in Github wiki

Including into project and default values:

import OnePageNav from 'purejs_onepagenav';

// Default constructor options
let options = {
    navLinksSelector: 'nav a',
    defaultLinkActive: true,
    updateATagClass: true,
    changeOffset: 50,
    parentsObtainingActiveClass: [],
    setClassesOnSections: false,
    exactMatch: false,
    navLinkActiveClass: 'active',
    sectionActiveClass: 'active',
    defaultActiveElement: undefined,
    updateHash: false,
    saveHashBetweenSections: true,
    onInit: [],
    onChange: [],
    debugLine: false,
};

let onePageNav = new OnePageNav(options);

//or

new OnePageNav.default(); // for alone imported umd file

// For some other combination might be necessery

import('purejs_onepagenav').then(() => {
     new OnePageNav.default(options)
})

License

The credit comments in the JavaScript files should be kept intact

(The MIT License)