Answer the question
In order to leave comments, you need to log in
How to style active site categories?
Hello.
There are categories on the site.
For example:
1. Vegetables
1.1 Cucumber
1.2 Tomato
2. Fruits
2.1 Apples
2.2
Pears
Not a category.
In JS I would do this:
let veget = document.querySelector('.veget'),
fruit = document.querySelector('.fruit');
if(window.location.pathname == "/tomato/") {
veget.classList.add('active');
}
Answer the question
In order to leave comments, you need to log in
You need to pass breadcrumbs the path to the section in js and check the existing internal links for being in breadcrumbs.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question