Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

active-scroll-navigation

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

active-scroll-navigation

Navigation will change active state when user scroll.

  • 1.0.16
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22
increased by450%
Maintainers
1
Weekly downloads
 
Created
Source

Scrolling Active Navigation

Whats This

This is a plain JavaScript Class that changes the active navigation item while the user scroll up/down the page. It has options for active class name and scroll offset. You can also turn the event listener for window scroll on and off if need along with retrieving the active item index.

https://codepen.io/Cagosto/pen/opwJoK

Installation

Get if from npm

npm i active-scroll-navigation

import it in your app

import ACTIVE_SCROLL from 'active-scroll-navigation'

How to use

new ACTIVE_SCROLL({
  nav: '.main-nav'
  offSet: 0,
  activeString: 'main-nav__item—active'
});

Settings

NameTypeRequiredValue
navStringTrue""
offSetNumFalse0
activeStringStringTruemain-nav__item--active

Get Active Index

const activeScroll = new ACTIVE_SCROLL();
let index = activeScroll.activeItem();

Events

const activeScroll = new ACTIVE_SCROLL();

activeScroll.eventsSrollOff() //Stop Scroll Listener

activeScroll.eventsSroll() //Start Scroll Listener

Keywords

FAQs

Package last updated on 09 Aug 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc