I'm currently revamping my personal portfolio website and had an idea for a cool feature. I want the header/navigation bar to change color based on which section of the webpage it's in (the site is one page only).
My initial thought was to add onclick events to the links that lead to different sections of the page. However, this method wouldn't allow me to update the color of the header when a user scrolls manually to a new section.
If anyone could guide me in the right direction, I would greatly appreciate it as I'm unsure where to begin.
For those interested, here is the current version of the website:
www.kylebinger.com
Below is the HTML markup related to the header:
<header>
<div class="container">
<nav>
<a href="#home">Welcome</a>
<a href="#featuredWork">Work</a>
<a href="#caseStudy">Case Study</a>
<a href="#about">About</a>
<a href="#contact">Contact</a>
</nav>
</div>
</header>
Thank you in advance for any assistance.