我正在使用一个名为“适应”的创世子主题。这是一个响应主题,这很棒。我从这里http://www.carriedils.com/widget-area-above-header-genesis/添加了一个固定的顶栏(实用工具栏),我想要包含一个响应式下拉菜单,社交媒体图标和搜索字段。
但是,当我尝试向该窗口小部件区域添加自定义菜单时,它不再用作下拉列表。子菜单只显示在下面。我试过谷歌搜索,但我无法弄清楚答案。如何让该小部件区域中的菜单以与主菜单相同的方式运行?这不可能吗?
非常感谢任何帮助。
编辑: 这是我添加到我的functions.php中的代码:
/** Register Utility Bar Widget Areas. */
genesis_register_sidebar( array(
'id' => 'utility-bar-left',
'name' => __( 'Utility Bar Left', 'theme-prefix' ),
'description' => __( 'This is the left utility bar above the header.', 'theme-prefix' ),
) );
genesis_register_sidebar( array(
'id' => 'utility-bar-right',
'name' => __( 'Utility Bar Right', 'theme-prefix' ),
'description' => __( 'This is the right utility bar above the header.', 'theme-prefix' ),
) );
add_action( 'genesis_before_header', 'utility_bar' );
/**
* Add utility bar above header.
*
* @author Carrie Dils
* @copyright Copyright (c) 2013, Carrie Dils
* @license GPL-2.0+
*/
function utility_bar() {
echo '<div class="utility-bar"><div class="wrap">';
genesis_widget_area( 'utility-bar-left', array(
'before' => '<div class="utility-bar-left">',
'after' => '</div>',
) );
genesis_widget_area( 'utility-bar-right', array(
'before' => '<div class="utility-bar-right">',
'after' => '</div>',
) );
echo '</div></div>';
}
编码主要和辅助导航的CSS如下所示:
.genesis-nav-menu{
clear: both;
font-size: 16px;
line-height: 1;
width: 100%;
}
.genesis-nav-menu .menu-item{
display: inline-block;
text-align: left;
}
.genesis-nav-menu a{
color: #999;
display: block;
padding: 20px;
}
.genesis-nav-menu a:hover,
.genesis-nav-menu .current-menu-item > a,
.genesis-nav-menu .sub-menu .current-menu-item > a:hover{
color: #333;
}
.genesis-nav-menu .sub-menu{
background-color: rgba(0, 0, 0, 0.05);
left: auto;
opacity: 1;
position: relative;
-webkit-transition: opacity .4s ease-in-out;
-moz-transition: opacity .4s ease-in-out;
-ms-transition: opacity .4s ease-in-out;
-o-transition: opacity .4s ease-in-out;
transition: opacity .4s ease-in-out;
z-index: 99;
}
.genesis-nav-menu .sub-menu a{
font-size: 14px;
padding: 20px;
position: relative;
}
.genesis-nav-menu .menu-item:hover{
position: static;
}
.genesis-nav-menu .menu-item:hover > .sub-menu{
left: auto;
opacity: 1;
}
/* Site Header Navigation
--------------------------------------------- */
.site-header .sub-menu {
border-top: 1px solid #eee;
}
.site-header .sub-menu .sub-menu {
margin-top: -56px;
}
.site-header .genesis-nav-menu li li {
margin-left: 0;
}
/* Primary Navigation
--------------------------------------------- */
.nav-primary {
background-color: #fff;
padding-bottom: 10px;
padding-top: 10px;
}
.nav-primary:before {
border-top: 3px double #eee;
height: 3px;
width: 84%;
margin: -20px auto 0;
padding-top: 10px;
}
/* Responsive Navigation
--------------------------------------------- */
.responsive-menu-icon,
.responsive-menu .menu-item-has-children {
cursor: pointer;
}
.responsive-menu .menu-item,
.responsive-menu-icon {
display: block;
}
.responsive-menu,
.responsive-menu > .menu-item > .sub-menu {
display: none;
}
.responsive-menu-icon {
text-align: center;
}
.responsive-menu-icon::before {
color: #000;
content: "\f333";
display: inline-block;
font: normal 20px/1 'dashicons';
margin: 0 auto;
padding: 10px;
}
.responsive-menu > .menu-item-has-children:before {
content: "\f347";
float: right;
font: normal 16px/1 'dashicons';
height: 16px;
padding: 15px 20px;
right: 0;
text-align: right;
z-index: 9999;
}
.responsive-menu .menu-open.menu-item-has-children:before {
content: "\f343";
}
.responsive-menu .sub-menu .sub-menu {
margin: 0;
}