understrap / understrap-child

The starter child theme for Understrap, the renowned open-source WordPress starter theme.
GNU General Public License v3.0
582 stars 332 forks source link

Make dropdown menu open by click, not on hover #176

Closed Hidieh closed 6 years ago

Hidieh commented 6 years ago

By standard Bootstrap 4 dropdown menus open by click. In understrap they open by hover. I have no issue with hover and would like to keep it that way, but now the hover is not working correctly and would rather use the clickable menu.

Right now the primary menu's dropdown opens even when you hover under the menu where the dropdowns will open up. That makes scrolling to the content of the page really hard. When the dropdown area happens to be over content's link or button, you can't click the link/button because the dropdown opens up and you end up clicking a dropdown link element.

Can I somehow make the dropdown menu's open by click or fix the problem with the hover (so that dropdown only opens when I hover over it's parent item, not over it's place where it would be when it's opened)? I tried to change this class: .dropdown:hover .dropdown-menu, but the hover stops working if I point it to the dropdown parent item's a-element.

My site: http://megasim.eu/talli Where you can see the problem by going under the menu with your mouse.

axlright commented 6 years ago

What version of Understrap is that? All my Understrap websites have menus that open on click, which is much better for touch devices - even large ones like Chromebooks and larger tablets.

Hidieh commented 6 years ago

@axlright I'm using the most latest one I believe. And the child-theme should be based on the latest child-base theme too? Can't check on the spot because it seems that my webhost's servers are down and can't access the live site lol...

Hidieh commented 6 years ago

I still have the problem. I currently have the exact same menu as in the parent theme understrap (just few extra classes for style, but none of the styles interfere with :hover etc. The menu still keeps opening the dropdowns when hovering over?!

My current menu_walker wp_nav_menu( array( 'theme_location' => 'primary', 'container_class' => 'collapse navbar-collapse', 'container_id' => 'navbarSupportedContent', 'menu_class' => 'navbar-nav mr-auto', 'fallback_cb' => '', 'menu_id' => 'main-menu', 'depth' => 2, 'walker' => new Understrap_WP_Bootstrap_Navwalker(), ) );

Parent theme is up to date (Versio 0.8.4).

holger1411 commented 6 years ago

Do you do any style changes in your child theme? Can you provide a URL? UnderStrap alway used the Bootstrap way to handle this...so there must be another reason for it.

Hidieh commented 6 years ago

Here's live example

holger1411 commented 6 years ago

Your theme loads a "custom.css" If I disable this stylesheet the behavior switches back to normal. A custom.css file is not loaded by default.

Pls check this file.