我已经使用了bootstrap菜单,我似乎看不出为什么汉堡包下拉不正常。
目前在移动设备上扩展了完整菜单,汉堡符号没有功能,我不确定代码中出了什么问题
完整代码html
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container" style="height: 63px;">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bootstrap-navbar-collapse-1"
aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand " href="<?php echo get_page_link(2); ?>">
<img src="<?php bloginfo('url'); ?>/wp-content/uploads/2016/10/logo.png">
</a>
<button type="button" class="btn button-primary-signup navbar-btn navbar-right hidden-xs">
Sign up
</button>
<button type="button" class="login-button btn btn-link navbar-btn navbar-right hidden-xs">
Login
</button>
</div>
<div id="navbar" style="background-color: #333;max-height: 44px;">
<div class="container">
<?php bootstrap_megamenu_nav(); ?>
</div>
</div>
</nav>
功能php
function bootstrap_megamenu_nav()
{
wp_nav_menu(array(
'theme_location' => 'locations-primary',
'depth' => 4,
'container' => 'div',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'bootstrap-navbar-collapse-1',
'menu_class' => 'nav navbar-nav yamm navbar-main-head',
'fallback_cb' => 'Yamm_Nav_Walker_menu_fallback',
'walker' => new Yamm_Nav_Walker())
);
}
id="bootstrap-navbar-collapse-1"
没有目标。
可折叠的导航项目应该包含在collapse
元素中。
有关一个示例,请参见Bootstrap文档:http://getbootstrap.com/components/#navbar-default