When I use this conditional it works great, it activates the active state when I am in segment 1, however, at the same time it disables the other class on the li 'dropdown'.

The 'dropdown' class is positioning relative, when its disabled the dropdown menu moves all the way to the right of the parent container.

Is their a different conditional which will allow me to NOT DISABLE the 2nd class (dropdown) on the il tag.

{if segment_1 == "donate"} class="active"{/if} class="dropdown">Donate


Well, you're having an HTML issue, not an EECMS issue, because an element can't have more than oneclass attribute.

Use this:

<li class="{if segment_1 == "donate"}active {/if}dropdown">Donate</li>

Or you can simple remove the dropdown class and use a child selector or a descendant selector. Even for JavaScript, you don't need this class. You can do an Event delegation at its parentElement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.