nuxt-headroom v0.1.0
Nuxt Headroom
Easy integration of Headroom.js within a Nuxt app.
Description
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.
This module is an extension for easy integration within a Nuxt web application.
Getting Started
Dependencies
- Nuxt 2.13+
- Nuxt > 2.10 || <= 2.12 requires @nuxt/components as dependency and added to buildModules
Installing
npm install nuxt-headroom- Add 'nuxt-headroom' dependancy to buildModules @ nuxt.config.js
- Auto-import of components must be set true @ nuxt.config.js
Usage
- How to run the program
- Step-by-step bullets
<template>
  <headroom>
    <header>Put your head code here...</header>
  </headroom>
</template>Props
speedTransition speed, in ms. Default: 350
easingTransition function. Default: ease-in-out
disabledDisable the headroom. Default: false
upToleranceScroll tolerance when scrolling up before component is pinned, in px. Default: 5
downToleranceScroll tolerance when scrolling down before component is pinned, in px. Default: 0
scrollerElement to listen to scroll events on. Default: () => window
classesCss classes to apply. Default:
{
  // when element is initialised
  initial : "headroom",
  // when scrolling up
  pinned : "headroom--pinned",
  // when scrolling down
  unpinned : "headroom--unpinned",
  // when above offset
  top : "headroom--top",
  // when below offset
  notTop : "headroom--not-top",
  // when at bottom of scoll area
  bottom : "headroom--bottom",
  // when not at bottom of scroll area
  notBottom : "headroom--not-bottom"
}offsetHeight in px where the header should start and stop pinning. Default: 0
zIndexThe z-index of component. Default: 9999
footroomSame behaviour but as a footer instead. Default: false
Events
pinCallback when header is pinned.
unpinCallback when header is unpinned.
unfixCallback when header is unfixed.
topCallback when above offset.
not-topCallback when below offset.
bottomCallback when at bottom of page.
not-bottomCallback when moving away from bottom of page.
Authors
Contributors names and contact info
Martijn Wennekes @gmail
Version History
- 0.1- Initial Release
 
License
Acknowledgments
4 years ago