Help with Navbar Dropdown
-
I am creating a custom theme and have menu support for the theme. I created a menu in under the ‘Appearance’ section and put some pages nested under an item on the navbar menu. I added the CSS to display the items on hover. But when I try to move my mouse to click on one of the items the dropdown goes away. Is there anything I have to do to make this work? Maybe a custom walker? Thanks for the help and if there is anything else you want to see please let me know. Here is some code:
From header.php:
<header class="site-header"> <nav class="container header-grid"> <div class="navigation-bar"> <div class="logo"> <a href="<?php echo home_url(); ?>" > <img class="img-logo" src="<?php echo get_template_directory_uri() . "/img/Rooted_LogoAsset-1.png"; ?>" alt=""/> </a> </div> <!--. logo--> <?php $args = array( 'theme_location' => 'main-menu', 'container' => 'nav', 'container_class' => 'main-menu', / 'menu' => 'main-menu', 'depth' => 0 ); wp_nav_menu($args); ?> </div><!--.navigation-bar--> </nav><!--.contianer--> </header>In functions.php:
add_theme_support('menus'); //Wordpress Function register_nav_menus(array( 'main-menu' => "Main Menu", 'footer-menu' => "Footer Menu" ));-
This topic was modified 5 years, 9 months ago by
verso1.
-
This topic was modified 5 years, 9 months ago by
Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
-
This topic was modified 5 years, 9 months ago by
-
can you please share the website link?
The problem is, is that the website is hosted locally on my machine currently. I can upload the theme onto a live site.
Edit: I will update the post once the the site is live.
-
This reply was modified 5 years, 9 months ago by
verso1.
Here is the link: https://vertomwebdev.com/
Hover your cursor over ‘Employee Resources’ to see the problem. Also, ignore the terrible CSS on the dropdown, threw it together quickly.Delete OR Comment “margin-top” from this class:-
li:hover > .sub-menu
find it in your style.css
-
This reply was modified 5 years, 9 months ago by
The topic ‘Help with Navbar Dropdown’ is closed to new replies.