hiding-header
Advanced tools
Comparing version 0.3.4 to 0.4.0
{ | ||
"name": "hiding-header", | ||
"version": "0.3.4", | ||
"version": "0.4.0", | ||
"description": "Toggles header visibility on scroll.", | ||
@@ -34,2 +34,3 @@ "main": "./dist/index.js", | ||
"rollup": "^2.33.1", | ||
"rollup-plugin-copy": "^3.3.0", | ||
"rollup-plugin-peer-deps-external": "^2.2.4", | ||
@@ -36,0 +37,0 @@ "rollup-plugin-typescript2": "^0.29.0", |
@@ -32,26 +32,4 @@ # Hiding Header [![npm](https://img.shields.io/npm/v/hiding-header.svg)](https://www.npmjs.com/package/hiding-header) [![Dependencies](https://img.shields.io/david/FilipChalupa/hiding-header.svg)](https://www.npmjs.com/package/hiding-header?activeTab=dependencies) ![npm type definitions](https://img.shields.io/npm/types/hiding-header.svg) | ||
```css | ||
.hidingHeader { | ||
position: relative; | ||
--hidingHeader-height: auto; | ||
--hidingHeader-bounds-height: auto; | ||
--hidingHeader-animation-offset: 0px; | ||
z-index: 10; | ||
height: var(--hidingHeader-bounds-height); | ||
margin-bottom: calc( | ||
var(--hidingHeader-height) - var(--hidingHeader-bounds-height) | ||
); | ||
pointer-events: none; | ||
} | ||
Import `dist/style.css` to your CSS. It's few lines of code. You can alternatively copy paste it and adjust things like `z-index` to your needs. | ||
.hidingHeader-in { | ||
position: relative; | ||
position: sticky; | ||
top: 0; | ||
pointer-events: auto; | ||
transition: transform 0.2s; | ||
transform: translateY(var(--hidingHeader-animation-offset)); | ||
} | ||
``` | ||
### JavaScript: | ||
@@ -58,0 +36,0 @@ |
30255
9
274
8
73