Security News
OpenJS: “XZ Utils Cyberattack Likely Not an Isolated Incident”
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
affixing-header
Advanced tools
Weekly downloads
Readme
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.
The module itself is available in a wide range of flavors:
dist/affixing-header.js
dist/affixing-header.js
window.affixingHeader
global with dependencies bundled in: dist/affixing-header-bundled.js
, or minified as dist/affixing-header-bundled-min.js
jsnext:main
in package.json), compatible with ES6-compatible module loaders like SystemJS or compilers like Babel: src/affixing-header.js
Exports a single function via require('affixing-header')
if being used with a CommonJS or AMD module loader, or else exposes the function as a global named window.affixingHeader
.
affixingHeader( element )
element
ElementThe DOM element to which the affixing behavior should be attached. Must be a single Element (e.g., the result of document.querySelector
or document.getElementById
), not a NodeList
.
This package uses onscrolling, a requestAnimationFrame-based, performant, mobile-friendly scroll event handler, to listen for page scrolls, but has no other dependencies.
The scroll handling uses requestAnimationFrame
, which is only available in IE10+. For older browsers, your header won’t affix to the top of the page when you scroll up, but you shouldn’t see any other issues (yay progressive enhancement). To add full support for older browsers, just include a requestAnimationFrame polyfill.
FAQs
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.
The npm package affixing-header receives a total of 6 weekly downloads. As such, affixing-header popularity was classified as not popular.
We found that affixing-header demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
Company News
Come meet the Socket team at BSidesSF and RSA! We're sponsoring several fun networking events and we would love to see you there.
Security News
OSI is starting a conversation aimed at removing the excuse of the SaaS loophole for companies navigating licensing and the complexities of doing business with open source.