DEV Community

Discussion on: How to create a sticky navbar with CSS & JavaScript

Collapse
 
thomasledoux1 profile image
Thomas Ledoux

Nice implementation!
For the Javascript part, you might want to consider using Intersection Observer (developer.mozilla.org/en-US/docs/W...) to track if the menu is in the viewport or not. It's highly configurable, you can even set thresholds too!