List Category Posts Add Class to Active Menu Item
-
I have a page where I list all of the posts within a certain category. I am trying to use JQuery to check the active page and add a unique class to the corresponding or outer
- – either way, just as long as I can use CSS to change the style so it works like the breadcrumbs. I’ve tried a number of scripts I think should be working, but can’t make any headway.
$(document).ready(function(){
$(‘#listcategorypostswidget-2 ul li a’).each(function(index) {
if(this.href.trim() == window.location)
$(this).addClass(“active”);
});
});Any assistance appreciated!
- The topic ‘List Category Posts Add Class to Active Menu Item’ is closed to new replies.