MCPcopy Index your code
hub / github.com/WickyNilliams/headroom.js

github.com/WickyNilliams/headroom.js @v0.12.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.12.0 ↗
17 symbols 35 edges 11 files 1 documented · 6%
README

Headroom.js

Headroom.js is a lightweight, high-performance JS widget (with no dependencies) that allows you to react to the user's scroll. The header on this site is a living example, it slides out of view when scrolling down and slides back in when scrolling up.

Installation

Headroom.js is available on npm. To install:

npm install headroom.js --save

# or...
yarn add headroom.js

A a universal build (suitable for script tags, CommonJS, and AMD) is available from unpkg.com:

https://unpkg.com/headroom.js

Documentation

For complete documentation please visit the headroom.js website.

Quick start

After installing headroom.js. The following JS will create and initialise a headroom instance:

import Headroom from "headroom.js";

// select your header or whatever element you wish
const header = document.querySelector("header");

const headroom = new Headroom(header);
headroom.init();

Then you can add the following CSS to your page:

.headroom {
  will-change: transform;
  transition: transform 200ms linear;
}
.headroom--pinned {
  transform: translateY(0%);
}
.headroom--unpinned {
  transform: translateY(-100%);
}

You should now see your header slide in and out in response to the user's scroll.

Contributions & Issues

Contributions are welcome. Please clearly explain the purpose of the PR and follow the current code style.

Issues can be resolved quickest if they are descriptive and include both a reduced test case and a set of steps to reproduce.

Contributing Guide

Setup

The following steps will get you setup to contribute changes to this repo:

  1. Fork the repo (click the Fork button at the top right of this page)
  2. Clone your fork locally
git clone https://github.com/<your_github_username>/headroom.js.git
cd headroom.js
  1. Install dependencies. This repo uses npm, so you should too.
npm install

Building

To build the project:

npm run build

To start a watcher for building the project and running tests:

npm start

Testing

To run the test suite in headless mode:

npm test

License

Licensed under the MIT License.

Core symbols most depended-on inside this repo

createScroller
called by 3
src/scroller.js
normalizeUpDown
called by 2
src/Headroom.js
isBrowser
called by 2
src/features.js
isDocument
called by 1
src/scroller.js
isWindow
called by 1
src/scroller.js
windowScroller
called by 1
src/scroller.js
elementScroller
called by 1
src/scroller.js
trackScroll
called by 1
src/trackScroll.js

Shape

Function 17

Languages

TypeScript100%

Modules by API surface

src/scroller.js5 symbols
src/features.js4 symbols
src/trackScroll.js3 symbols
src/angular.headroom.js2 symbols
src/Headroom.js2 symbols
cypress/integration/headroom.spec.js1 symbols

Dependencies from manifests, versioned

cypress3.4.1 · 1×
eslint6.5.0 · 1×
eslint-plugin-cypress2.7.0 · 1×
rollup1.19.4 · 1×
rollup-plugin-eslint7.0.0 · 1×
rollup-plugin-filesize6.2.0 · 1×
rollup-plugin-license0.12.1 · 1×
rollup-plugin-uglify6.0.2 · 1×

For agents

$ claude mcp add headroom.js \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact