@pluginjs/headroom

0.8.11 • Public • Published

Headroom

npm package

A flexible modern headroom js plugin.

Samples

Introduction

Installation

Yarn

yarn add @pluginjs/headroom

NPM

npm i @pluginjs/headroom

Getting Started

CDN:

Development:

<script src="https://unpkg.com/@pluginjs/headroom/dist/headroom.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/headroom/dist/headroom.css">

Production:

<script src="https://unpkg.com/@pluginjs/headroom/dist/headroom.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@pluginjs/headroom/dist/headroom.min.css">

Initialize

HTML:

<div class="element"></div>

ECMAScript Module:

import Headroom from "@pluginjs/headroom"
import "@pluginjs/headroom/dist/headroom.css"

Headroom.of(document.querySelector('.element'), options)

CommonJS:

require("@pluginjs/headroom/dist/headroom.css")
const Headroom = require("@pluginjs/headroom")

Headroom.of(document.querySelector('.element'), options)

Browser:

<link rel="stylesheet" href="https://unpkg.com/@pluginjs/headroom/dist/headroom.css">
<script src="https://unpkg.com/@pluginjs/headroom/dist/headroom.js"></script>
<script>
  Pj.headroom('.element', options)
</script>

API

Options

Options are called on headroom instances through the headroom options itself. You can also save the instances to variable for further use.

Name Description Default
"tolerance" normalize Tolerance, Mainly used in pinned mode {"down":10,"up":20}
"offset" Anchor offset, Mainly used for pinned mode and stick mode 0
"scroller" Scroll element window
"mode" Different judgments pinned
"offsetSide" If offset is an element selector, you can specify his size top

Events

Events are called on headroom instances through the headroom events itself. You can also save the instances to variable for further use.

Name Description
"ready" Gets fired when plugin is ready
"destroy" Gets fired when plugin is destroy
"enable" Gets fired when plugin is enabled
"disable" Gets fired when plugin is disabled

Methods

Methods are called on headroom instances through the headroom method itself. You can also save the instances to variable for further use.

Name Description
"destroy" Destroy plugin
"disable" Disable plugin
"enable" Enabled plugin if plugin is disabled

Classes

Name | Description | Default --|| "NAMESPACE" | Declare plugin namespace | pj-headroom "PINNED" | Announce plugin is pinned | {namespace}-pinned "UNPINNED" | Announce plugin is unpinned | {namespace}-unpinned "TOP" | Announce plugin is top | {namespace}-top "NOTTOP" | Announce plugin is notTop | {namespace}-notTop "STICK" | Announce plugin is stick | {namespace}-stick "UNSTICK" | Announce plugin is unstick | {namespace}-unstick

Browser support

Tested on all major browsers.

IE / EdgeIE / Edge FirefoxFirefox ChromeChrome SafariSafari OperaOpera
IE11, Edge last 2 versions last 2 versions last 2 versions last 2 versions

License

@pluginjs/headroom is Licensed under the GPL-v3 license.

If you want to use @pluginjs/headroom project to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary.

For purchase an Commercial License, contact us purchase@thecreation.co.

Copyright

Copyright (C) 2022 Creation Studio Limited.

Readme

Keywords

none

Package Sidebar

Install

npm i @pluginjs/headroom

Homepage

pluginjs.com

Weekly Downloads

8

Version

0.8.11

License

GPL-3.0

Unpacked Size

43.6 kB

Total Files

14

Last publish

Collaborators

  • thecreation
  • kaptinlin