This is about Bulma | Navbar.
When the number of navbar-elements inside a navbar-dropdown increases, a mobile user has to scroll a lot to get to the bottom of the navbar. It would be really nice if there was a way (something like, is-collapsible-mobile) to collapse these navbar-items on mobile screen to save some extra scrolling.
This is about the Bulma CSS framework
Menu 1, Menu 2, Menu 3 to be collapsible on mobile screens:
https://codepen.io/tanmaydas/pen/ppPgXY (Load this in mobile view)
Menu 1, Menu 2, Menu 3 are automatically expanded on mobile screens.
Thread updated with an example.
@jgthms Any input or example on how to accomplish this? I've run into this issue with my current setup and would like to allow a navbar-dropdown element (which is only made visible on mobile) to be shown as collapsed and give the user the ability to expand it if they need. I think the psuedo-solution provided by @tanmay-das is a viable one. Adding a mobile modifier for navbar-dropdown elements would be the cleanest way to accomplish this in my opinion.
@tanmay-das While we wait for @jgthms input I've worked out a hack-y workaround if you haven't already figured out another way. Here's the JsFiddle with a single dropdown menu that appears on mobile only. I've added some jquery to toggle the dropdown collapse.
I just run into the same issue. Kinda frustrating since it even becomes worse if the navbar is fixed. Then you cannot even navigate if you try with fixed-bottom since the bottom:0; css rules makes it impossible to navigate up& down through the menu if it is big enough.
help yourself and use the responsive modifiers
is-hidden-touch for example works great for me, I apply it at the navbar-dropdown
https://bulma.io/documentation/modifiers/responsive-helpers/#hide
@KaotiKcr I was hoping for a CSS-end solution, rather than a JS-end solution. Sure I can toggle a class like I have done in this pen: https://codepen.io/tanmaydas/pen/dKbBQK
...but I think at least this should be supported out of the box since navbar is a major part of the framework. Writing JS for even something as simple as this increases JS overhead in my opinion...
No javascript workaround, just place this in your mobile media query (It's SASS but you can turn it to css easily)
`
.navbar-item {
&.has-dropdown {
.navbar-dropdown {
display: none;
}
&.is-active {
.navbar-dropdown {
display: block;
}
}
}
}
`
Would really, really appreciate if this feature is added as well. I have too many items in my navigation and it completely overwhelms a mobile screen. We need a lot more mobile nav customization and nav customization, in general, as this otherwise great framework matures. I have yet to get one of the above options to work for my purpose, unfortunately.
Just came accross this same issue while creating my navigation.
Indeed the navbar should have a collapsed state for all menu / submenu items in "burger"-mode.
Does not seem logic to have it uncollapsed.
I've tried the proposed solutions, all of them are only able to hide the dropdown items (content). But you can't reach them anymore (e.g. by hover/click in burger mode).
I've tried the proposed solutions, all of them are only able to hide the dropdown items (content). But you can't reach them anymore (e.g. by hover/click in burger mode).
You better share your implementation...
Hey ,
Still Can hide the drop down on mobile but cant reach any thing inside it
any suggestions . Thank you
Hey ,
Still Can hide the drop down on mobile but cant reach any thing inside it
any suggestions . Thank you
you can try and set in css pointer-events:none
Below is a 3 line fix in jquery that is compatible with any bulma implementation. hope this helps!
$(".navbar-item.has-dropdown").click(function () {
$(this).children().children().toggle();
});Spot on, that did it
>
$(".navbar-item.has-dropdown").click(function () { $(this).children().children().toggle(); });
Hello.
You can add this to your css file:
@media only screen and (max-width: 1024px) {
.navbar-item {
&.has-dropdown {
.navbar-dropdown {
display: none;
}
&:hover {
.navbar-dropdown {
display: block !important;
}
}
}
}
everything is hidden on your desired media width and expandable on click!
Most helpful comment
No javascript workaround, just place this in your mobile media query (It's SASS but you can turn it to css easily)
`
.navbar-item {
`