Live 4-Header SnapEagerness Comparison

All four headers are active simultaneously! Scroll to see how different snapEagerness values behave in real-time.

๐Ÿ’ก How to test: Scroll at different speeds and directions. Watch how each header responds to your scrolling. The higher the snapEagerness value, the more "eager" the header is to snap into position.

Natural (0.0) Pure natural movement, may show gaps
Balanced (1.0) Default sweet spot
Eager (2.0) Prevents gaps aggressively
Magnetic (3.0) Intentional snap effect

๐Ÿ” What to Observe While Scrolling

1. Natural Movement (0.0) - Green Header

This header moves exactly with your scroll speed, providing the most intuitive experience. Notice how it feels completely connected to your scrolling motion.

2. Balanced Default (1.0) - Blue Header

The default value provides a sweet spot between natural movement and gap prevention. It predicts one scroll step ahead for smoother transitions.

3. Eager Prevention (2.0) - Orange Header

More aggressive gap prevention that predicts two scroll steps ahead. Notice the more pronounced snapping behavior.

4. Magnetic Effect (3.0) - Red Header

Creates an intentional "magnetic" attraction to the top edge. The snapping becomes a deliberate part of the design language.

๐Ÿงช Try These Tests

Slow Scrolling: All headers should feel natural and smooth.

Fast Scrolling: Notice how higher values prevent gaps but feel less natural.

Direction Changes: Quickly reverse scroll direction and observe how each header responds.

Momentum Scrolling: On mobile/trackpad, try flick scrolling to see behavior during deceleration.

๐ŸŽฏ Making Your Choice

The right snapEagerness value depends on your specific use case:

Choose 0.0-1.0 when:

Choose 1.5-2.5 when:

Choose 3.0+ when:

๐Ÿ“ Implementation

Setting snapEagerness is simple:

// Natural movement
naturalStickyTop(element, { snapEagerness: 0.0 });

// Balanced default (same as omitting the parameter)
naturalStickyTop(element, { snapEagerness: 1.0 });

// Eager gap prevention
naturalStickyTop(element, { snapEagerness: 2.0 });

// Magnetic effect
naturalStickyTop(element, { snapEagerness: 3.0 });

Keep scrolling to continue testing all four behaviors simultaneously!

This direct comparison eliminates the guesswork - you can immediately see and feel the differences between each setting.