Jump to content

Keep parent category selected


duimstra

Recommended Posts

Hi!

I already modified my category-tree-branch.tpl to show the class="selected" on LI elements instead of A elements.

When one of my primary navigation options is selected, it works great. But when I select a child (secondary navigation level), the class="selected" appears only on the child LI and disappears from parent LI.

QUESTION: How can I echo class="selected" on parent element also?

Thanks!

Link to comment
Share on other sites

A quick and dirty solution for my problem:

$().ready(function() {
   if($('#main-nav ul li ul li.active').length > 0) {
       $('#main-nav ul li ul li.active').parent().parent().addClass('active');
   }
});



Works for me, at the moment. :)

I'd still rather see a solution with PHP since not everybody has JavaScript..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...