BS3-可折叠导航栏与另一个可折叠导航栏

时间:2018-11-18 11:50:23

标签: html twitter-bootstrap twitter-bootstrap-3

我想使此导航栏可折叠。页眉应折叠所有项目,然后第一个项目应折叠其他3个项目。现在,当我单击标题时,导航栏将折叠并在其后立即再次显示。你能指出我吗?

<div id="body" class="container">
  <section id="navBar" class="col-md-3 navbar navbar-default">
    <div class="navbar-header primary">
      <a class="navbar-brand" data-toggle="collapse" data-target="#navbar" href="#">navigation</a>
    </div>
    <div class="collapse navbar-collapse" id="navbar">
      <ul class="nav navbar-nav">
        <li class="nav"><a href="#">payment transactions</a></li>
        <li class="nav active"><a href="#">payment transactions</a></li>
        <li class="nav"><a href="#">transaction notes</a></li>
        <li class="nav"><a href="#">slow transactions</a></li>
      </ul>
    </div>
  </section>

1 个答案:

答案 0 :(得分:0)

我的代码中有几个问题。这是分辨率:

<section class="col-md-3 navbar navbar-default">
    <div class="navbar-header">
      <a href="#navbar" class="navbar-brand" data-toggle="collapse">navigation</a>
    </div>
    <div class="collapse in" id="navbar">
      <ul class="nav navbar-nav">
        <li class="nav"><a href="#">payment transactions</a></li>
        <li class="nav active"><a href="#">payment transactions</a></li>
        <li class="nav"><a href="#">transaction notes</a></li>
        <li class="nav"><a href="#">slow transactions</a></li>
      </ul>
    </div>
  </section>