Hi there!

I recently, yesterday took the step and moved from WP to Drupal and I must say, I like it a lot! Now to my problem.

I would like to style every/each (not sure) other primary links but still use a.active on the "active" page. I'll try to explain litlle more:

link1 class="a"

link2 class="b active(example)"

link3 class="a"

link4 class="b"

etc....

I hope you all understand and excuse my poor language, I'm Swedish :)

Any ideas?

/Tobias

Comments

jix_’s picture

The menu_attributes module is what you need.

Jeff Burnz’s picture

Hej fellow Swedish drupaler!

You can do this with a small bit of jQuery, in your themes script.js do this:

if (Drupal.jsEnabled) {
  $(document).ready(function() {

    // Set even class on every second primary li
    $("#primary ul li:nth-child(2n)").addClass("even");
  
  });
}

You will need to modify #primary depending on your theme.

Style your links as per normal and then override the ones with the .even class, that way if js is disabled it will degrade gracefully.