折叠后,Bootstrap CSS菜单无法打开

时间:2016-07-28 20:08:55

标签: html css twitter-bootstrap

我正在使用Pico CMS。这是导航代码

<!-- Navigation -->
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapseID">
                <span class="sr-only">Toggle navigation</span>
                Menu <i class="fa fa-bars"></i>
            </button>
            <a class="navbar-brand" href="#">Broadstone Services</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="navbar-collapse collapse" id="collapseID">
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <a href="/">Home</a>
                </li>
                <li>
                    <a href="about">About</a>
                </li>
                <li>
                    <a href="solutions">Solutions</a>
                    </li>
                <li>
                    <a href="contact">Contact</a>
                </li>
                <li>
                    <a href="blog">Blog</a>
                </li>

    </ul>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>

当我的页面全屏时,菜单项看起来很棒。但是,当页面窗口变得更小(或在移动设备上)时,菜单不会扩展。

1 个答案:

答案 0 :(得分:2)

您没有加载执行功能解除崩溃的jQuery和Bootstrap JavaScript库。

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" crossorigin="anonymous"></script>

请参阅http://getbootstrap.com/getting-started/

有关功能参考,请参阅:https://github.com/twbs/bootstrap/blob/master/dist/js/bootstrap.js#L557