Back to Browse

Easily change sticky nav styling on scroll

82.3K views
May 16, 2023
12:11

When you have a sticky header or navigation, it’s very common to want to change the background of it, or add a shadow to it, so in this video I look at an easy way to do it with an intersection observer. 🔗 Links ✅ Ryan Mulligan’s article: https://ryanmulligan.dev/blog/sticky-header-scroll-shadow/ ✅ More on intersection observers: https://youtu.be/T8EYosX4NOo ✅ More on animating box-shadows: https://youtu.be/u6Rur7G8HNY ✅ The code from this video: https://codepen.io/kevinpowell/pen/xxyybmj ⌚ Timestamps 00:00 - Introduction 00:21 - What we’re starting with 01:48 - The JavaScript setup 04:30 - Creating the intersection observer 10:12 - Adding an offset #css -- Come hang out with other dev's in my Discord Community 💬 https://discord.gg/nTYCvrK Keep up to date with everything I'm up to ✉ https://www.kevinpowell.co/newsletter Come hang out with me live every Monday on Twitch! 📺 https://www.twitch.tv/kevinpowellcss --- Help support my channel 👨‍🎓 Get a course: https://www.kevinpowell.co/courses 👕 Buy a shirt: https://teespring.com/stores/making-the-internet-awesome 💖 Support me on Patreon: https://www.patreon.com/kevinpowell --- My editor: VS Code - https://code.visualstudio.com/ --- I'm on some other places on the internet too! If you'd like a behind the scenes and previews of what's coming up on my YouTube channel, make sure to follow me on Instagram and Twitter. Twitter: https://twitter.com/KevinJPowell Codepen: https://codepen.io/kevinpowell/ Github: https://github.com/kevin-powell --- And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!

Download

0 formats

No download links available.

Easily change sticky nav styling on scroll | NatokHD