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

affixing-header

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

affixing-header

An affixing header that behaves normally as a user navigates down a page, but reveals itself naturally when a user scrolls or drags upwards. Inspired by iOS Safari, Medium, and others.

  • 1.0.0-beta.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
74
decreased by-70.4%
Maintainers
1
Weekly downloads
 
Created
Source

Affixing Header  build workflow

Create an affixing header that behaves normally as a user navigates down a page, but reveals itself naturally when a user scrolls or drags upwards. Inspired by iOS Safari, Medium, and others. See an example implementation to see what it’s about. Works on desktop and mobile browsers.

Usage

The module is ESM-only and exports a single default affixingHeader function:

affixingHeader( element )

element HTMLElement

The DOM element to which the affixing behavior should be attached. Must be a single HTMLElement (e.g., the result of document.querySelector or document.getElementById), not a NodeList.

affixingHeader return value

affixingHeader function (element: HTMLElement) => () => void

The affixingHeader function returns a cleanup function that takes no arguments and is used to remove listeners and cleanup the affixing behavior.

Dependencies

This package uses onscrolling, a requestAnimationFrame-based, performant, mobile-friendly scroll event handler, to listen for page scrolls, but has no other dependencies.

Compatibility

The scroll handling uses requestAnimationFrame, which is only available in IE10+. To add full support for older browsers, just include a requestAnimationFrame polyfill.

Keywords

FAQs

Package last updated on 15 Jun 2024

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