自举导航移动下拉自动展开

时间:2017-01-03 15:01:43

标签: javascript jquery html css twitter-bootstrap

我现在已经重建了两次,今天早上我已经注意到我的引导菜单汉堡包符号在移动设备上展开菜单现在正在显示并且菜单已经扩展了,原因是什么?

    

    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#exCollapsingNavbar2"
            aria-expanded="false" aria-controls="navbar">
        <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(6); ?>"><img
                src="<?php bloginfo('url'); ?>/wp-content/uploads/2016/10/logo.png"></a>
    <button type="button" class="btn btn-primary navbar-btn navbar-right hidden-xs" style="margin-left: 10px"><span class="glyphicon glyphicon-user"></span> Sign in</button>
    <button type="button" class="btn btn-primary navbar-btn navbar-right hidden-xs"><span class="glyphicon glyphicon glyphicon-log-in"></span> Login</button>
</div>
<div id="navbar" style="background-color: #333;">
    <div class="container">
            <?php
            /* Primary navigation */
            wp_nav_menu(array(
                    'menu' => 'Primary Menu',
                    'theme_location' => 'locations-primary',
                    'depth' => 2,
                    'container' => 'div',
                    'container_class'   => 'collapse navbar-collapse',
                    'container_id'      => 'exCollapsingNavbar2',
                    'menu_class'        => 'nav navbar-nav',
                    'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
                    'walker'            => new wp_bootstrap_navwalker())
            );
            ?>
    </div>
</div>

2 个答案:

答案 0 :(得分:0)

类“折叠”(按钮)应该是原因。

答案 1 :(得分:0)

看起来应该是这样的

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#exCollapsingNavbar2">
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span> 
  </button>