使nav-tabs可折叠,就像bootstrap中的nav-bar一样

时间:2016-06-16 06:47:41

标签: javascript css twitter-bootstrap twitter-bootstrap-3

我希望在移动设备中制作一个导航标签,例如bootstrap中的nav-bar默认值。试试这里:https://jsfiddle.net/7d3mxv3a/1/

<ul id="accountNav" class="account-nav nav nav-tabs" role="tablist">
    <li class="active">
        <a href="external-page.html" >External link 1</a>
    </li>
    <li>
        <a href="external-page.html">External link 2</a>
    </li>
    <li>
        <a href="external-page.html">External link 3</a>
    </li>
    <li>
        <a href="external-page.html">External link 4</a>
    </li>
    <li>
        <a href="external-page.html" >External link 5</a>
    </li>
    <li>
        <a href="external-page.html">External link 6</a>
    </li>
</ul>

我想要这个: enter image description here

1 个答案:

答案 0 :(得分:0)

你走了......他们现在可以折叠了......

<script src="https://code.jquery.com/jquery-2.2.4.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>


 <nav class="navbar navbar-default">
        <div class="container-fluid">
          <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" 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="#">Project name</a>
          </div>
          <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
              <li class="active"><a href="#">Home</a></li>
              <li> <a href="external-page.html" >External link 1</a></li>
              <li><a href="external-page.html">External link 2</a></li>
              <li >
                <a href="external-page.html">External link 3</a>    </li>
                
              <li> <a href="external-page.html">External link 4</a></li>
              <li><a href="external-page.html" >External link 5</a></li>
              <li class="dropdown">
                <a href="external-page.html">External link 6</a>   </li>
            </ul>
            
          </div><!--/.nav-collapse -->
        </div><!--/.container-fluid -->
      </nav>