我试图寻找这个问题&一无所获! 基本上我的导航栏不会在移动设备上崩溃。菜单保持扩展&我不知道为什么。
自己检查: http://flux.network/wp/
代码:
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<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 bloginfo( $name ); ?></a>
</div>
<?php
wp_nav_menu( array(
'menu' => 'primary',
'theme_location' => 'primary',
'depth' => 2,
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker())
);
?>
<form class="navbar-form navbar-right" role="socialicons">
<div class="form-group">
<?php ?>
<?php if ( ot_get_option('menu_search') != "off" ) { ?>
<?php get_search_form(); ?>
<?php } ?>
</div>
</form>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
答案 0 :(得分:0)
您应该将导航包装在.navbar-collapse元素中。我可以看到关闭&#34; .navbar-collapse&#34;的注释,但看不到开始标记。