I'm building a website using Wordpress. Most of the nav menu links, link to an id on the homepage. So when I load my site all the links that link to a place on the homepage are currently active. I removed the script in Wordpress that checks to see if its active. I figured I could use bootstrap scrollspy to get this done or even this JSFiddle https://jsfiddle.net/cse_tushar/Dxtyu/141/
The problem I'm having is since the navigation is being spit out by Wordpress I don't have the ability to go in and actually hard code "active" to the first li element and then do a add class and remove class. How would I alter the above JSFiddle so it does a hash target. So whenever I scroll and hit a div with the same ID as a nav item it triggers the active class and stays active until I hit another one or change pages. Here is what my nav looks like on wordpress.
<nav class="collapse navbar-collapse" role="navigation">
<ul id="menu-primary-navigation" class="nav navbar-nav">
<li class="current-menu-item current_page_item menu-about"><a href="/#about">About</a></li>
<li class="current-menu-item current_page_item menu-team"><a href="/#team">Team</a></li>
<li class="current-menu-item current_page_item menu-services"><a href="/#services">Services</a></li>
<li class="menu-services"><a href="/blog">Blog</a></li>
<li class="current-menu-item current_page_item menu-contact-us"><a href="/#contact">Contact Us</a></li>
</ul>
</nav>
<div id="about">
Something Here
</div>
<div id="team">
Something Here
</div>