我的菜单如下所示:关于我们|定价|联系。定价项目是一个自定义链接:home.local#home-pricing,“关于我们和联系方式”均指向子页面。

我遇到的问题是,在显示定价部分的静态主页上,主页和定价项都用current-menu-item类突出显示。

我的少:

.current-menu-item {
    a {
        @extend .btn;
        padding-left: $base-padding + 9px;
        padding-right: $base-padding + 9px;
    }
}

.btn {
    background: $yellow-color;
    border-radius: $base-radius;
    padding: $btn-padding;
    color: $purple-color;
    text-transform: uppercase;
    margin-top: $base-padding * 2;
    font-family: $heading-font-family;
    font-size: $base-font-size + .500rem;
    border: 0;
    &:hover {
        color: $purple-color;
        text-decoration: underline;
        @include linear-gradient($yellow-color 50%, $darker-yellow-color);
    }
}


和我的主页:

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
    <?php get_template_part('templates/head'); ?>

    <body <?php body_class(); ?>>
        <?php get_template_part('templates/fb'); ?>
        <?php get_template_part('templates/header'); ?>

        <div id="home-about-us">
            ...
        </div><!-- #home-about-us -->
        <div id="home-pricing">
            ...
        </div><!-- #home-pricing -->
        <div id="home-news">
            ...
        </div><!-- #home-news -->
    </body>

    <?php get_template_part('templates/footer' ); ?>
</html>


您能帮我找到解决方案吗?

最佳答案

您可以像单击价格菜单时一样使用javascript,然后可以在价格菜单中添加活动类并从主页菜单中删除

10-06 07:46
查看更多