XF 2.0 Public navigation one link, show at mobile only

kelle67

Well-known member
Hi ist it possinle to add one link and to show at mobile only?
Maybe i can use "Display condition" for that?

191561
 
Solution
No conditional for that. I think the best approach would be a two part edit, page_container find:

Code:
                    <xf:foreach loop="$navTree" key="$navSection" value="$navEntry" i="$i" if="{{ $navSection != $xf.app.defaultNavigationId }}">
                        <li>

Change the <li> to this:

Code:
<li class="nav{$navSection}">

This will give the parent level of the navigation items a class so you can hide them using css:


191662


Your css in extra.less:

Code:
.p-nav-list li.navmembers { display: none; }

This will hide the link in the main navigation but not in the off-canvas menu.
No conditional for that. I think the best approach would be a two part edit, page_container find:

Code:
                    <xf:foreach loop="$navTree" key="$navSection" value="$navEntry" i="$i" if="{{ $navSection != $xf.app.defaultNavigationId }}">
                        <li>

Change the <li> to this:

Code:
<li class="nav{$navSection}">

This will give the parent level of the navigation items a class so you can hide them using css:


191662


Your css in extra.less:

Code:
.p-nav-list li.navmembers { display: none; }

This will hide the link in the main navigation but not in the off-canvas menu.
 
Solution
No conditional for that. I think the best approach would be a two part edit, page_container find:

Code:
                    <xf:foreach loop="$navTree" key="$navSection" value="$navEntry" i="$i" if="{{ $navSection != $xf.app.defaultNavigationId }}">
                        <li>

Change the <li> to this:

Code:
<li class="nav{$navSection}">

This will give the parent level of the navigation items a class so you can hide them using css:


View attachment 191662


Your css in extra.less:

Code:
.p-nav-list li.navmembers { display: none; }

This will hide the link in the main navigation but not in the off-canvas menu.
Many thnaks Russ, I had been scratching my head over this.

One thing though, do you know how to do the same for sub navigation items? Thanks
 
Top Bottom