Okay, I have to do something where the navbar changes color when the user scrolls down the page such as with this page. The site is using BootStrap. Does anyone have any idea how that is done?
The site IS using bootstrap, and they’re calling the scrollspy doodad. https://getbootstrap.com/docs/4.0/components/scrollspy/
Now, you can do something similar yourself, simply by adding an event listener to the scroll event of your HTML body. If a given element (
section scrolls past the bottom of your
nav el (all involving a little math, to get the top position of the divs and the bottom position of the nav), then the change happens.
Are you looking to use bootstrap, or implement the same functionality in vanilla JS?
Of course, their page is a little confused – the ‘#about’ div CONTAINS the ‘#gallery’ div, so the nav menu looks like it just had a seizure, twitching around a bit…
Thanks for all your help everyone!