dropdown in navigation?
-
@phenomlab No worries, this is still a pain point for me.
I have been using above technique on a couple of forums via widgets but it is not ideal. It works well for desktops and larger screens but for mobile we have to push the secondary menu items into the top default menu (stock menu) via JS due to the real estate issue. So yes it is possible, but not ideal as it doesn't load sometimes for mobile users if there is a js error in any of the third party services (like ads).
I also tried updating the stock header via persona tpl files, but i've been burned as the theme structure updates frequently with new releases. I've learned to avoid overwriting the templates.
The best approach would be to have this ability in the core to handle either multi level navigation or a better responsive setup which can hold relatively larger number of menu items.
Mega menus are pretty common in majority of websites these days and if nodebb team supports them it would solve the issue. e.g https://geedmo.github.io/yamm3/
-
@baris said in dropdown in navigation?:
This will be available in our next release. https://github.com/NodeBB/NodeBB/issues/9967
Hi @baris , is there any way to re-group several navigation items into one as a dropdown menu while maintaining their visibility settings?
we have several plugins that use navigation bar such as:
/map
/calendar
/feed
/glossary(some are for registered users only and opens in a new window)
So, the navigation bar is getting crowded, I wonder if there is any way to implement this?
-
No built in way to do it. But you can control the visibility of the dropdown menu items via custom css.
Here is a sample dropdown that shows an item for logged in users and a different item for guests.
<li class="loggedin"><a href="https://somelink.com">visible to logged in users</a></li> <li class="guest"><a href="https://otherlink.com">visible to guests</a></li>
Once you create a dropdown like that you can control the visibility via custom css. The body element is given a class based on the user's logged in status.
user-loggedin
if they are logged in anduser-guest
if they are logged out.So in your custom css you can use those classes.
#main-nav .dropdown-menu .loggedin, #main-nav .dropdown-menu .guest { display: none; } body.user-loggedin #main-nav .dropdown-menu .loggedin { display: block; } body.user-guest #main-nav .dropdown-menu .guest { display: block; }