Balanced Behavior (snapEagerness: 1.0) - Default

Configuration: { snapEagerness: 1.0 } or simply naturalStickyTop(element)

This is the recommended default value that balances natural movement with gap prevention through subtle scroll prediction.

⚖️ Balanced approach: This value predicts one scroll step ahead, switching to sticky just before gaps would appear, while maintaining natural feel.

🎯 Why This is the Default

After extensive testing across different browsers, devices, and user behaviors, snapEagerness: 1.0 emerged as the sweet spot:

📐 The Prediction Algorithm

Here's how the one-step prediction works in the source code:

const handleScroll = () => {
  const currentScrollY = window.scrollY;
  const elementRect = element.getBoundingClientRect();
  
  // Calculate scroll velocity (distance moved this frame)
  const scrollVelocity = currentScrollY - lastScrollY;
  
  // Predict where the element will be after one more scroll step
  const predictedTop = elementRect.top - snapEagerness * scrollVelocity;
  //                                      ↑
  //                            snapEagerness: 1.0 = predict 1 step ahead
  
  // Switch to sticky when prediction shows element would be at/past top
  if (mode === 'relative' && predictedTop >= 0) {
    mode = 'sticky';
    element.style.position = 'sticky';
    element.style.top = '0';
  }
}

🔬 Technical Deep Dive

The magic happens in the prediction calculation:

🚀 When to Use the Default (1.0)

This balanced approach is ideal for:

📱 Mobile Optimization

The 1.0 value is specifically tuned for mobile momentum scrolling:

Pro tip: If you're unsure which snapEagerness value to choose, start with 1.0 and only change it if you have specific issues to solve.

🔍 Testing This Configuration

Try these specific scroll patterns to see the balanced behavior:

📊 Comparison with Other Values

Understanding where 1.0 fits in the spectrum:

⚡ Performance Characteristics

The balanced approach offers optimal performance:

Continue scrolling to experience how this balanced approach handles various scroll patterns. The goal is for the behavior to feel so natural that you don't think about it - the header should just "work" the way you expect.

The Sweet Spot in Action!
Notice how natural this feels while being completely reliable.
This is why 1.0 is the default choice.