The problem is I have a navigation in two parts. Top Nav and Left Nav. I need to tell the top link to have a class of ".active" if the left navigation's sibling is the current url.
EX: If you're on a child link of about ie - "Bio" I need to tell the top nav link "About" link to have the class of .active.
Home | About | Contact
<-- Page Content Here -->
<ul id="leftnav">
<li>Home</li>
<li><a href="ul.com/">About</a>
<ul>
<li>Bio</li>
<li>History</li>
<li>Location</li>
</ul>
</li>
<li>Contact</li>
</ul>
I tried this:
$(document).ready(function() {
currentPage = window.location.pathname;
if( $('.sidebarNav li a[href$="' + currentPage + '"]').parent('#aboutParent')) {
$('#aboutTopNav a').addClass('active');
}
});