[[+content_image]]
S
S
San0072019-12-05 10:00:29
css
San007, 2019-12-05 10:00:29

How to add a class to a menu item in MODX?

Good afternoon.
We have two templates:
1. Main (landing)
2. All other pages of the site.
The site header is the same on all pages. In both templates, navigation is rendered via [[$nav]].
In the chunk itself, the usual HTML of the form:

<ul>
<li class="active">Меню 1</li>
<li>Меню 2</li>
<li>Меню 3</li>
<li>Меню 4</li>
</ul>

I highlight the first menu item in a different color as the selected menu item.
The question is, how, through additional fields, to highlight the remaining menu items during the transition?
Or how to move class="active" to other menu items on transition?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
S
strelok011, 2019-12-05
@San007

Modx has a lot of plugins. Use something like the most basic classic wayfinder. Or pdomenu, or whatever)
These plugins have options to configure any navigation state. Specify the active element, hide the current section or root, and so on.
You can connect and write classes on top of styles out of the box, you can implement your own templates for all occasions.
i--gu.ru/wayfinder for example. Or read on the modx documentation site

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question