Navbar Bootstrap移动菜单

时间:2015-03-13 09:52:55

标签: html twitter-bootstrap

显然,使用我的引导程序导航栏,移动版本上没有按钮,在我的Windows Phone上进行测试。 我在导航栏中使用以下代码:

    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <a class="navbar-brand" rel="home" href="#"><img src="img/logo.png" style="height: 75px"></a>
            <a class="navbar-brand" rel="home" href="#">Name</span></a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">Home</a></li>
                <li><a href="#">Placeholder1</a></li>
                <li><a href="#">Placeholder2</a></li>
                <li><a href="#">Placeholder3</a></li>
          </ul>
        </div>
    </div>
</nav>

在此代码中,我如何为我的网站的移动版添加按钮?

1 个答案:

答案 0 :(得分:1)

以下是我在网站上总是使用的导航栏代码。

 <!-- Navigation bar -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>
    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse navbar-ex1-collapse">
      <ul class="nav navbar-nav navbar">
        <li><a data-scroll href="#top">Link 1</a></li>
        <li><a data-scroll href="#link2">Link 2</a></li>
      </ul>

    </div><!-- End navbar-collapse -->
  </div><!-- End container -->
</nav><!-- End Navigation bar -->