Navbar崩溃在移动版中不起作用?

时间:2015-05-14 17:21:33

标签: twitter-bootstrap

我的引导程序导航栏崩溃在移动版本中无效。

这是我的代码:

<nav class="navbars  navbar-inverse">
    <div class="row">
        <div class=" col-xs-12 ">
            <div class="navbar-header " role="navigation">
                <button type="button" class="navbar-toggle pull-left" data-toggle="collapse" data-target="#myNavbar">
                 <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span> 
                  </button>
            <div class="collapse navbar-collapse" id="myNavbar">
                <ul class="nav  navbar-nav  ">
                   <li><a href="<?= site_url('api/about_us') ?>"> About Us</a></li>
                   <li ><a href="<?= site_url('api/home') ?>"><span class="glyphicon glyphicon-home"></span>  Home</a></li>
                   <li><a href="<?= site_url('api/regis') ?>"><span class="glyphicon glyphicon-user"></span> Volunteer Registration</a></li>
                   <li><a href="<?= site_url('api/postingcomplaints') ?>"><span class="glyphicon glyphicon-comment"></span> Post Complaints</a></li>
                   <li><a href="#" class=" pull-right"   data-toggle="modal" data-target="#myModal2"><span class="glyphicon glyphicon-map-marker"></span> Track Complaints</a></li>
                   <li><a href="<?= site_url('api/contact') ?>"><span class="glyphicon glyphicon-phone-alt"></span> Contact Us</a></li>
                   <li> <a href="#" class=" pull-right"   data-toggle="modal" data-target="#myModal"><span class="glyphicon glyphicon-log-in"></span>LogIn</a></li>

                </ul>

            </div>
            </div>
        </div>
    </div>  
 </nav>
<!--nav end-->

任何人都可以告诉我我做错了什么吗?

1 个答案:

答案 0 :(得分:2)

您需要设置 1。 jQuery 2。 JavaScript {/ strong>(订单很重要!)在<head>部分。

<head>
    <script src="https://code.jquery.com/jquery-2.1.4.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>

Demo