移动导航BG颜色/汉堡菜单错误

时间:2020-04-10 21:06:10

标签: html css wordpress

我的客户Wordpress网站上有一些项目需要解决方法。我有这行代码试图覆盖并使其透明,但是,它不断从原始style.css变回蓝色。

问题1:

<nav class="navbar navbar-dark bg-transparent fixed-top navbar-expand-lg justify-content-between px-md-5 py-4 fullwidth-container" itemscope="" itemtype="http://schema.org/SiteNavigationElement" role="navigation">

我想从以下地方隔离并取走:

@media (max-width: 979px)
.navbar-dark.bg-transparent {
    background-color: #2f5be7 !important;
}

对此:

@media (max-width: 979px)
.navbar-dark.bg-transparent {
    background-color: transparent !important;
}

问题2

大型菜单在Android上无法正确呈现。实际的子菜单应该具有www.dwellwellco.com/services页面,但是,下拉菜单将显示为#,并且仅提供子类别页面。

问题#3

当您单击任何其他页面时,它与Android上的Mega菜单有关。初次点击时,汉堡菜单不会打开。您必须单击几次(否则菜单可能根本无法打开。

谢谢您的帮助!


供参考的网站网址: www.dwellwellco.com

1 个答案:

答案 0 :(得分:0)

关于问题1

但是,它会不断从原始style.css恢复为蓝色。

您可以create a child theme,将父主题样式表设置为子主题样式表的依赖项,以确保在此之后加载。

WordPress docs提供的示例:

<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
    $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
}

然后添加您的CSS规则,即

@media (max-width: 979px)
.navbar-dark.bg-transparent {
    background-color: transparent !important;
}

在您的孩子主题的style.css