HTML:
<div class="logo-ribbon">
<a href="#top"></a>
</div>
<nav id="nav">
<ul>
<li class="what">
<a href="#what">what </a>
</li>
<li class="how">
<a href="#how">how </a>
</li>
<li class="projects">
<a href="#projects">projects</a>
</li>
<li class="faq">
<a href="#faq">faq</a>
</li>
<li class="contact">
<a href="#contact">contact</a>
</li>
</ul>
</nav>
JS:
$('nav li a').click(function(e) {
e.preventDefault();
$('a').removeClass('active-state-navigation');
$(this).addClass('active-state-navigation');
$('logo-ribbon a').click(function(){
$('nav li').removeClass('active-state-navigation');
});
});
what i need to achieve is the following:
a classic active state once you click on a menu item.. and this i already achieved with the first lines of js
i would like the active state to be triggered also on page scroll. so that if i scroll, let's say, to the #contact section, the active state changed to the "contact" menu item
i also need that, if i click on ".logo-ribbon a", the "active-state-navigation" is removed anywhere it is in nav.