Header Active Links

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
jcw2m
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 27
Joined: Fri Sep 07, 2012 9:51 am

Header Active Links

Post by jcw2m » Thu Sep 27, 2012 2:00 pm

In the past when clients wanted active link styled navigation we used envolicity as a workaround. With envolicity gone there are a lot of resolved issues with jquery $ etc. - awesome! :) The thing is I am wondering if anyone else might know why this is an issue in the header:

Code: Select all

<script type="text/javascript" charset="utf-8">
jQuery(function() {
  jQuery('.primary-nav a').each(function() {
    if (jQuery(this).attr('href')  ===  window.location.pathname) {
      jQuery(this).addClass('current');
    }
  });
});  
</script>
It works with all links added like <a href="/Contact-Us-W1.aspx" class="primary-nav">Contact Us</a>
It fails with Wishlist, My Account, Basket links even when stated as "href" instead of "<asp:HyperLink..."

I've tried a lot of different approaches and keep coming up empty. Any thoughts or suggestions would be greatly appreciated.

Post Reply