Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

How to hide sub-sub-menu before it's parent is active?

Started by Muut Archive 10 years ago · 2 replies · 535 views
10 years ago

I have a custom theme based on the RTFM skeleton in the works. Now I'm trying to hide a sub-sub-item in the navigation before it's parent is active. A live example is in the RTFM skeleton demo: http://demo.getgrav.org/rtfm-skeleton/

Requirements
-Sub-Topic
--Sub-Sub-Topic

Now as you can see the Sub-Sub-Topic is visible in the menu always. What I want is to only show Sub-Topic when Requirements is active page and then when Sub-Topic is active page, show also Sub-Sub-Topic.

I have a lot of Sub-Sub-pages coming to the website (a total of +40) so it's not an option to just list them as Sub-pages.

This is my first web page with GRAV so I'm still somewhat a noob here.

10 years ago

You could do this via CSS, for example:

CSS
.dd-item .dd-item ul li { display: none; }
.dd-item .dd-item.active ul li { display: block; }
10 years ago

Thanks! With your example I was able to hide the sub-sub-link from the menu and show it when I open the sub-menu but when the sub-sub-link was active it would hide again from the menu. Fixed it with this:

CSS
.dd-item.parent > ul > li { display: block; }

Works now as I wanted it to :)

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1357 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago