am-impact / amnav

Navigation plugin for Craft
168 stars 20 forks source link

Class for items with no children #97

Closed waswebb closed 6 years ago

waswebb commented 7 years ago

Hi

I use your plugin for a project in witch i should have the option to give a li tag with no children a class like no-children. Like the included class has-children.

That would be great if you can help me.

hubertprein commented 6 years ago

You'd be able to do this with the getNavRaw sample: https://github.com/am-impact/amnav#build-the-way-you-like-it

{%- if node.hasChildren -%}
    {%- set nodeClasses = nodeClasses|merge(['has-children']) -%}
{% else }
    {%- set nodeClasses = nodeClasses|merge(['no-children']) -%}
{%- endif -%}