Forum

Thread tagged as: Question, Problem, Configuration

Subitem Dropdown

Hi there,

I would like to show there is a dropdown menu present on my sidebar i have all the html and css in place but it does not show until i click one of the items and only then does it show there is a dropdown.

CODE USED:

    <perch:before>
    <ul class="uk-nav uk-nav-side uk-nav-parent-icon" data-uk-nav="{multiple:true}">
</perch:before>
        <li class="<perch:if exists="subitems"> uk-parent </perch:if>uk-nav-divider<perch:if exists="current_page"> uk-active </perch:if>"><perch:if exists="ancestor_page">uk-parent </perch:if><a href="<perch:pages id="pagePath" />"><perch:pages id="pageNavText" /></a>
            <perch:pages id="subitems" encode="false" />
        </li>
<perch:after>
    </ul>
</perch:after>

I have uploaded our work to a Test Site:

https://fl-brand.fineline-websolutions.co.uk/

If you click on any of the sidebar items you will see only when clicking one of the sidebar items the Our brand personality will only then show there are sub items. Is there a way to show there is a submenu before clicking into the sidebar?

Kind Regards Alec

Alec Sharples

Alec Sharples 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How does the markup need to change?

Drew McLellan said:

How does the markup need to change?

Hi Drew,

I would like the caret to be active at all times but it seems only active when clicking the sidebar items.

This is not the behaviour of the sub items

This is the default code:

<ul class="uk-nav uk-nav-parent-icon" data-uk-nav>
    <li class="uk-parent">
        <a href="">...</a>
        <ul class="uk-nav-sub">
            <li><a href="">...</a></li>
            <li><a href="">...</a></li>
        </ul>
    </li>
</ul>

Regards Alec

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. What does your perch_pages_navigation() call look like the page? Which options do you have set? Perhaps you just need to increment the number of levels.

Hi Drew.

Sorry i forgot to include the navigation template.

     <?php
    perch_pages_navigation(array(
                           'from-path'            => '*',
                           'levels'               => 5,
                           'template'             => 'sidenav1.html',
                           'siblings'             => true,
));
?>

I have tried many different options without luck!

Alec

Drew McLellan

Drew McLellan 2638 points
Perch Support

Try:

perch_pages_navigation(array(
    'levels' => 5,
    'template' => 'sidenav1.html',
));

Drew McLellan said:

Try:

perch_pages_navigation(array(
   'levels' => 5,
   'template' => 'sidenav1.html',
));

Hi Drew,

That removes many of the nav items when clicking a sidebar item as seen in the demo link.

Alec

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, try adding

'from-path' => '/',

Hi Drew,

Still not getting the desired results, i have tried everything from the docs.

Not really sure what i am doing wrong!

Alec

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me what you want to output? I'm making wild stabs in the dark because I don't understand what you're trying to do. What do you mean by dropdown and caret?

Drew McLellan said:

Can you show me what you want to output? I'm making wild stabs in the dark because I don't understand what you're trying to do. What do you mean by dropdown and caret?

Hi Drew,

I would really like to thank you for your time helping me!

I have created a quick video

https://screencast.com/t/x9MmIdXGgC6

I hope this explains better!

Alec

Drew McLellan

Drew McLellan 2638 points
Perch Support

The uk-parent class will only be added if there are subitems. If you're restricting the levels that are returned, there may not be subitems in the returned data even if they do exist in the tree.

Drew McLellan said:

The uk-parent class will only be added if there are subitems. If you're restricting the levels that are returned, there may not be subitems in the returned data even if they do exist in the tree.

Hi,

Not really sure what you are saying Drew, can this be done or not using Perch?

Even adding of depth of 5 should indicate there is a submenu item from default, why is the click needed to show a visual there is a sub item?

Alec

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, I'm sure it can be done.

The 'click' means that you're drilling down an extra level into the site, correct? So the navigation must be

a) Different on the top level to the sub level, or

b) Depending on context