I’m working with Bootstrap and I’ve been able to get the hover over to work for sub menus. However, I can’t disable it on mobile.
I did get this to work some.
@media only screen and (max-width:768px) {
.dropdown:hover {
display: none !important;
}
}
However, I took that out because I got some funny glitches when I used that and I couldn’t get the sub menu to stay open when I clicked on an li once the menu went responsive.
Lets say "Our School"s class is “dropdown” and menus class starting with “About Us” is “dropdown-menu”.
Then you must:
.dropdown:hover .dropdown-menu {
display: none;
}
Edit: Actually, i just looked at your source. If you hide your menu using “display: none” while hover, you can’t show it when “.dropdown” clicked. Because hover handler still run at click. You must use some jquery at least.
Yea. I tried that earlier and it just stuck. What kind of jQuery solution when I need to do? Right now I’m not ever sure of something to try in jQuery.
We need to know which handler in bootstrap shows the menu on hover. If we add some jquery to hide it, it can be shown when bootstraps handler run.
I don’t think it will a big issue on mobile because of hover handler doesn’t work in mobile screens. If you test your website on mobile screens you won’t see the that hover effect.
Edit again: I think it will show the menu because of last touch as hover. My mistake. Let me think about it.