Hello!
There is a section highlighting script - adds a class to the parent element. It works even when sending GET-parameters in the address bar and taking into account the catalog nesting. BUT! I have a directory /magazine/male_articles/
, and there are /magazine/male_articles/
, for example /magazine/male_articles/some_category/
. When you go to a category, the class is added to both the current section and the general section /magazine/male_articles/
, that is, this section is main, and the others are nested, and since it is present in the address of each nested link, it is highlighted constantly. How can I remove the backlight from it when choosing subcategories?
The script itself:
$(function () { $('.magazine_nav ul li a').each(function () { var location = window.location.href var link = this.href var result = location.match(link); if(result != null) this.parentNode.className = "active_article"; }); });