Hello, everyone!
What JavaScript code should I insert so that when the user is navigating (scrolling) over a section, the "li a" receives a new class to change the color of the link?
Ideally, the "#inicio" section should receive the class by default and that this code work for both menus (# menu-mobile and # menu-desktop).
#menu-mobile li a, #menu-desktop li a {
color: #666666;
}
<header>
<ul id="menu-mobile">
<li><a href="#inicio" class="scroll inicio">página inicial</a>
</li>
<li><a href="#atuacao" class="scroll atuacao">área de atuação</a>
</li>
<li><a href="#portfolio" class="scroll portfolio">nosso portfolio</a>
</li>
<li><a href="#contato" class="scroll contato">entre em contato</a>
</li>
</ul>
<ul id="menu-desktop">
<li><a href="#inicio" class="scroll">página inicial</a>
</li>
<li><a href="#atuacao" class="scroll">área de atuação</a>
</li>
<li><a href="#portfolio" class="scroll">nosso portfolio</a>
</li>
<li><a href="#contato" class="scroll">entre em contato</a>
</li>
</ul>
</header