P
Peek.js

Live Monitor

Header Status Pinned
Position At Top
Scroll Y 0px
Lightweight & Zero Dependency

Smart Navigation,
Zero Distraction.

Download Back To CSSScript.Com

A modern JavaScript library for intelligent header behavior. It hides when you explore, and returns when you need it.

Scroll to test

Why Peek.js?

Modern users demand screen real estate. Static headers waste valuable space on small devices. Peek.js solves this with elegant scroll intent detection.

Ultra Fast

Optimized with requestAnimationFrame for 60fps performance.

Tiny Footprint

Less than 2kb gzipped. No jQuery or heavy dependencies.

Smart Thresholds

Ignores accidental tiny scrolls to prevent jittery headers.

Top Awareness

Maintains visibility when users are at the top of the page.

CSS Driven

Uses classes for animations, giving you full control over the feel.

Interactive Showcase

Experience the different modes and states that make Peek.js the best choice for your next project.

Default Behavior

Scroll down to hide, up to show.

  • Offset: 100px
  • Tolerance: 5px
  • Class-based transitions
Peek('.header-main');

High Tolerance

Requires intentional large movement.

  • Offset: 200px
  • Tolerance: 50px
  • Prevents accidental reveals
Peek('.header', { tolerance: 50 });

Keep scrolling to see the header react...

Mobile Friendly

Perfect for mobile views where every pixel of vertical space counts.

Modern Layouts

Integrates seamlessly with fixed, sticky, or absolute positioned headers.

Developer First

Simple API, clear events, and full control over state classes.

Wait for it... scroll up now!

Implementation is Easy

1

Structure your HTML

<header class="header-main">
  <!-- Your beautiful navigation -->
</header>
2

Define the transitions (CSS)

/* Standard class-based logic */
.main-header--unpinned {
  transform: translateY(-100%);
}
.main-header--pinned {
  transform: translateY(0);
}
3

Initialize the magic

// One line is all you need
Peek('.header-main');