hundstage
Member
Posted 4 months ago #
hi,
i need to highlight my active menu item, i know that the latest method to do so is the current-menu-item class.
but as i am loading my content via ajax for some reasons, the menu is always on the same page (home).
does anybody knows the trick to highlight the menu link?
this ist the page: http://beringer.auskas.net/ (work in progress ;))
wpismypuppet
Member
Posted 4 months ago #
If you are using ajax to load content onto the page, then use jQuery to add/remove the current-menu-item class from the menu item in question. Something like jQuery('#menu-item-8').addClass('current-menu-item'). Don't forget to use .removeClass() to take it off the "old" link...
hundstage
Member
Posted 4 months ago #
ok, cool.
i ended up doing this:
$(function() {
$('#nav ul li a').click(function() {
$('#nav ul li a').each(function() {
$(this).removeClass('selected');
});
$(this).addClass('selected');
});
});
and then just style my .selected class in css