New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

.travis.yml

21

package.json
{
"name": "affixing-header",
"version": "0.1.1",
"version": "0.2.0",
"description": "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.",
"main": "dist/affixing-header.js",
"scripts": {
"test": "mocha --timeout 10000",
"build": "esperanto -i src/affixing-header.js -o dist/affixing-header.js -t umd -n affixingHeader",
"test": "node test/bootstrap.js",
"test-mocha": "mocha --reporter spec test/bootstrap.js",
"build": "esperanto -b -i src/affixing-header.js -o dist/affixing-header.js -t umd -n affixingHeader",
"build-install": "npm install -g esperanto;"

@@ -35,2 +36,3 @@ },

"chai-as-promised": "^4.3.0",
"colors": "^1.0.3",
"es6-module-loader": "^0.16.1",

@@ -40,9 +42,18 @@ "esperanto": "^0.6.24",

"mocha": "^2.2.1",
"mocha-multi": "^0.6.0",
"mocha-sauce-notifying-reporter": "0.0.1",
"saucelabs": "^0.1.1",
"selenium-webdriver": "^2.45.1",
"serve-static": "^1.9.2",
"should": "^5.2.0"
"serve-static": "^1.9.2"
},
"dependencies": {
"jank-free-onscroll": "^0.2.1"
},
"jspm": {
"directories": {
"lib": "src"
},
"main": "affixing-header",
"format": "es6"
}
}

@@ -1,2 +0,28 @@

# affixing-header
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.
# Affixing Header  [![Build Status](https://travis-ci.org/acusti/affixing-header.svg?branch=master)](https://travis-ci.org/acusti/affixing-header)
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][acusti.ca]. Works on desktop and mobile browsers.
[![Sauce Test Status](https://saucelabs.com/browser-matrix/acusti.svg)](https://saucelabs.com/u/acusti)
## Usage
The object exports an `affixing-header` module if being used with a CommonJS or AMD module loader, or else exposes a global object as `window.affixingHeader`.
### `affixingHeader( element )`
#### `element` Element
The DOM element to which the affixing behaviour should be attached. Must be a single Element (e.g., the result of `document.querySelector` or `document.getElementById`), not a `NodeList`.
### Dependencies
This package uses [jank-free onscroll][], 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+][raf-caniuse]. For older browsers, your header simply won?t affix when you scroll up, but you shouldn?t see any other issues (yay progressive enhancement!). To add compatibility for older browsers, just include a [requestAnimationFrame polyfill][raf-polyfill].
[acusti.ca]: http://www.acusti.ca
[jank-free onscroll]: https://github.com/acusti/jank-free-onscroll
[raf-caniuse]: http://caniuse.com/#feat=requestanimationframe
[raf-polyfill]: https://gist.github.com/paulirish/1579671

@@ -57,3 +57,5 @@ 'use strict';

// If this is bounce scrolling (e.g. Mac OS, iOS), bail
if (scrollY < 0 || (scrollY + window.innerHeight) > document.documentElement.scrollHeight) {
// Another way to check the top
//(scrollY + window.innerHeight) > document.documentElement.scrollHeight
if (scrollY < 0 || document.documentElement.scrollHeight - document.documentElement.scrollTop < document.documentElement.clientHeight) {
return;

@@ -60,0 +62,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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