Platform
VaultVault
  • Free15
  • Navigation19
  • Buttons9
  • Scroll55
  • Text27
  • Sliders & marquees19
  • Gallery & images67
  • Cursor24
  • Page transitions10
  • Loaders2
  • Backgrounds10
  • UI components33
ButtonsPart of ProButtons
IconsPart of ProIcons
  • Interface Essentials144
  • Social Icons69
  • Payment Badges41
SavedPart of ProSaved
Support
DocumentationDocumentation
MCP serverMCP server
SettingsSettings
VaultNavigationHide on Scroll Header
Glow Border ButtonBrowse all 182Horizontal Panels
  • Free15
  • Navigation19
  • Buttons9
  • Scroll55
  • Text27
  • Sliders & marquees19
  • Gallery & images67
  • Cursor24
  • Page transitions10
  • Loaders2
  • Backgrounds10
  • UI components33
  • Interface Essentials144
  • Social Icons69
  • Payment Badges41
Sign inSign in

Start free. The code for 15 components, no card needed.

Get 15 free

Hide on Scroll Header

This one is locked. Become a member to open the code for it and the rest of the Vault.

See plansTry the 15 free ones

What you'll need.

Install

  • gsap
  • ScrollTrigger

Setup

npm i gsapregisterPlugin(ScrollTrigger)

More like this

  • Header
  • ScrollTrigger

Features.

  • A fixed nav bar that slides up out of the way, shrinking slightly, once you scroll down past 100px
  • Scroll up at any point and it drops straight back with a slight overshoot
  • Stays put while any data-hhd-keep zone (your hero) is on screen
  • Tabbing into the hidden bar brings it back, and it stays while keyboard focus is inside it
  • Small scroll jitter is ignored: the direction only flips after 6px of travel
  • A blurred wash of the page colour fades in behind it once the page leaves the top, so the links stay legible over images
  • Logo on the left, centred links with one accent, icon links on the right with 44px tap areas; links hide on phones (767px and below)
  • Clears the notch: the bar's padding includes the safe-area insets
  • The motion is plain CSS transitions; the script only adds two classes
  • Respects prefers-reduced-motion: the bar hides and shows without sliding
  • GSAP and ScrollTrigger

How to get it right.

Mark your hero

Add data-hhd-keep to the hero (or any section where the bar must stay). While any part of it is on screen, scrolling down won't hide the bar.

Leave room at the top

The bar is position: fixed, so it covers the top of the page. Give the first section enough top padding (the demo's hero has 6em) so its content starts below the bar.

Pick a threshold that fits

100px hides it almost as soon as you start reading. On pages with a short hero and no keep zone, raise it so the bar doesn't vanish on the first flick.

One accent, at most

The first link is in the accent colour. More than one and nothing stands out.

Variations.

  • Default — hides after 100px, blurred wash on
  • Late hide — data-au-threshold="400" so it stays for the first 400px of scroll
  • Clear bar — data-au-wash="false": no backdrop, for pages with a plain background
  • No accent — remove hhd_link--accent from the first link
  • Your colours — override --hhd-bg, --hhd-text, --hhd-muted, --hhd-accent and --hhd-mark on .hhd_header

Where it fits.

  • Content sites — long articles where the bar should give way to the text
  • Portfolios and shops — image-heavy pages, like this demo
  • Landing pages — the bar stays over the hero, then gets out of the way
  • Docs — reading space on the way down, navigation one flick up

Frequently asked.

Yes. Replace the SVG inside .hhd_logo. The demo's logo uses currentColor for the wordmark so it follows --hhd-text; keep the hhd_logo-svg class for sizing.

The hero has data-hhd-keep. Remove the attribute to let the bar hide there too.

Yes. It reads the scroll through ScrollTrigger, so with Lenis connect them as usual (lenis.on("scroll", ScrollTrigger.update)).

Not included. Below 768px the links are hidden; add your own menu button to .hhd_icons.

No. Load gsap and ScrollTrigger before the script.

Related components.

NewPro

Ink Spread Menu

Click

Pro

Folding Burger Nav

Scroll

Pro

Full-Screen Wipe Menu

Click