Easily change sticky nav styling on scroll

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

IntermediateWeb DesignUI12 min

About this video

Shows how to change the background or add a shadow to a sticky navigation bar when the user scrolls, using an intersection observer in vanilla JavaScript. The video walks through the setup, the observer, and adding an offset.

What you’ll learn

  • Set up a sticky header that responds to scroll position
  • Use an intersection observer to toggle a scroll style
  • Adjust the trigger point with an offset