How can I change Navbar background colour when toggled div arrived the viewport?
Good afternoon, I want the Navbar's colour changes when the specific DIV arrived the viewport, currently I use the window.scrollY listener but it works poorly when the page size changed. Is there any better method? Thank you
The DIV will have an ID.
3 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Thank you, watching it:https://www.youtube.com/watch?v=RxnV9Xcw914
Kevin Powell
YouTube
How to change your navigation style on scroll
This video explores using the Intersection Observer API to watch for an element leaving the page and then changing the style of a fixed navigation bar.
GitHub repo: https://github.com/kevin-powell/navbar-change-on-scroll
(includes start and finished versions)
I set up some custom properties ahead of time to make the change really super simple,...
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View