npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@contentpilot/sticky-navigation

v1.7.2

Published

Add identifiers and activate the anchors that have these identifier and are intercepted with the scroll.

Downloads

113

Readme

Content Pilot Sticky Navigation

Scroll the page and note how the marker animates to highlight all of the sections that are currently on screen.

Installation

npm install @contentpilot/sticky-navigation --save-dev

Require JS file in task runner

./node_modules/@contentpilot/sticky-navigation/index.js

Import and initialize

const sticky = require('@contentpilot/sticky-navigation');

The options parameter is optional.

sticky.init(options);

Options

clause: String

Clause element selector. The script will not run if this element does not exist. Default is .sticky-navigation. Use syntax of querySelector

const options = {
	clause: ''
};

identifiers: String

Selector of elements to which the ID attribute will be added. Default is h2, h3, h4, h5, h6. Use syntax of querySelectorAll

const options = {
	identifiers: ''
};

interceptors: String

Selector of elements that when intercepted will add the active class in the anchors that have that destination. Default is h2[id], h3[id], h4[id], h5[id], h6[id]. Use syntax of querySelectorAll

const options = {
	interceptors: ''
};

offsetAnchor: Number

Offset distance when scrolling. Useful when using a fixed header. Default is 0. Ignored if offsetElement was defined.

const options = {
	offset: 0
};

offsetElement: String

Element selector to calculate offset dynamically. Useful when the offset varies according to an element that is not always present. Default is empty.

const options = {
	offsetElement: ''
};

inactiveUpperZone: Number

Distance in pixels from the top where items are not activated. Useful when you have a fixed header, you scrolls up and you don't want to activate the element while it is behind the header. Default is 0.

const options = {
	inactiveUpperZone: 170
};

interceptionPercentage: Number

Distance in percentage from the top for the items to activate. If for example you want the items to activate when they are in the middle of the screen, use 50. Default is 20.

const options = {
	interceptionPercentage: 50
};

Publish to NPM

To update this repository on NPM using the GitHub action,

  1. Bump the version number in package.json
  2. Follow the pattern on your commit message Release x.x.x
  3. Push to main branch to origin