您可以在http://prodenvermovers.wpupkeep.org上查看网页
当我将鼠标悬停在“服务”页面上时,它不会显示下拉菜单。 下拉菜单是通过wp_nav_menu在wordpress中创建的。我有5页,其中之一是“服务”页,其中包含3页的下拉菜单。我也在使用wp_bootstrap_navwalker
我尝试了很多东西。首先,我在wp_bootstrap_navwalker中更改了一些数据
$atts['href'] = 'http://prodenvermovers.wpupkeep.org/services/';
$atts['data-hover'] = 'dropdown';
我从boostrap响应中删除了绝对类,它显示了,但是像这样 查看图片-> http://prntscr.com/oh5lzk 正如您在这张图片上所看到的,它通过下拉菜单推送了我的徽标和免费评估。
header.php
/**
* The header for our theme
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package crosscountry
*/
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="https://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-76356877-1', 'auto');
ga('send', 'pageview');
</script>
<body <?php body_class(); ?>>
<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'crosscountry' ); ?></a>
<!-- header parts -->
<header id="masterhead" class="site-header">
<div class="md-wrapper">
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light">
<a class="country-logo" href="<?php echo site_url() ?>">
<img class="country-logo-style" src="<?php echo get_bloginfo("template_directory"); ?>/images/header/logo_pdm.png" alt="Pro Denver Movers Logo" ></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="col-md-12 col-lg-7 padding-nav-left">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<?php
wp_nav_menu( array(
'menu' => 'header_menu_1 ',
'depth' => 3,
'container' => false,
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'wp_page_menu',
//Process nav menu using our custom nav walker
'walker' => new wp_bootstrap_navwalker())
);
?>
</div>
</div>
<div class="col-md-3 md-header-cta-class">
<a class="md-header-estimate" href="<?php echo site_url('free-estimate') ?>">Free Estimate</a>
</div>
</nav>
</div>
</div>
</div>
</header>
<div id="content" class="site-content">
md-header.css
background: transparent;
float: left;
width: 100%;
z-index: 2;
overflow: hidden;
border-bottom: 1px solid rgb(194, 194, 194);
}
header#masterhead .container {
background: transparent;
}
.site-title,
.site-description {
display: none;
}
.country-logo {
margin: 0;
}
.country-logo-style {
width: 193px;
height: 60px;
}
.menu-navigation {
margin-top: 5px;
}
/* STYLING UL ELEMENTS */
.navbar {
padding: 0 !important;
}
.navbar-nav {
color: #333333;
margin-left: 100px;
text-transform: uppercase;
margin: 0;
}
.nav-item {
padding-left: 0px;
padding-right: 0px;
font-weight: 600;
}
.site-header {
overflow: hidden;
}
a.nav-link {
padding-bottom: 25px !important;
padding-top: 25px !important;
border-bottom: 4px solid transparent;
width: 100px;
font-size: 16px;
color: #fff !important;
transition: all 0.5s ease-in;
}
.site-header .nav-link:hover {
border-bottom: 4px solid #ecf014 ;
color: rgb(235, 235, 235) !important;
}
@media screen and (max-width: 1255px) {
.nav-item {
padding-left: 10px;
}
.nav .navbar-nav li a {
font-size: 14px;
}
}
nav .navbar-nav li a:hover {
color: #0082ff !important;
}
.site-header .navbar .navbar-collapse li > a {
padding: 30px 0 !important;
margin-left: auto;
margin-right: auto;
text-align: center;
max-width: 100%;
}
a.md-header-estimate {
font-size: 18px;
letter-spacing: 0px;
border-radius: 5px;
background: #b4b4b4;
opacity: 1;
font-weight: 500;
padding: 14px 42px;
color: white;
}
.md-header-cta-class {
text-align: right;
}
.fa {
position: absolute;
cursor: pointer;
transition: background 2s;
}
.fa:hover {
background: #dcf7ff;
border-radius: 5px;
}
.padding-nav-left {
padding-left: 70px;
}
.dropdown-menu a.dropdown-item {
font-size: 14px;
font-weight: bold;
padding-top: 5px !important;
padding-bottom: 5px !important;
}
.nav-item .dropdown-menu li {
padding-left: 25px !important;
padding-right: 15px !important;
}
.fa-chevron-down:before {
line-height: 25px;
margin-left: 5px;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
margin: -1px 0 0 0;
}
.wrapper .navbar .dropdown.dropdown-menu {
display: none;
margin: 0;
height: 100%;
min-width: 220px;
text-align: left;
background: #fff;
padding: 20px 0;
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.4);
color: #16345e;
position: absolute;
z-index: 99999;
}
.wrapper .navbar .dropdown:hover .dropdown-menu {
display: block;
}
.dropdown-toggle:after {
content: "\f063";
font-size: 15px;
visibility: visible;
padding-left: 5px;
font-family: fontawesome;
}
.site-header .navbar .navbar-nav .active > a {
border-bottom: 4px solid #ecf014 ;
}
@media screen and (max-width: 1400px) {
.navbar-nav > li > a {
font-size: 14px !important;
}
a.vk-header-phone {
font-size: 16px;
}
}
@media screen and (max-width: 1650px) {
.vk-header-cta-class {
text-align: right;
}
}
@media screen and (min-width: 991px) and (max-width: 1200px) {
.site-header .navbar .navbar-collapse li {
padding-left: 0 !important;
}
.padding-nav-left {
padding-left: 20px !important;
}
}
@media screen and (max-width: 991px) {
.navbar-collapse {
padding: 0;
}
button.navbar-toggler {
float: right;
}
a.md-header-estimate {
display: none;
}
.padding-nav-left {
padding-left: 15px;
}
.site-header .navbar .navbar-collapse li a {
padding-top: 10px !important;
padding-bottom: 10px !important;
}
}
@media screen and (max-width: 500px) {
.country-logo-style {
width: auto;
height: auto;
}
}
这可能是因为标头中包含引导类col-md-7和col-md-5吗?我不知道。 伙计们我需要在星期一之前完成这件事
答案 0 :(得分:2)