鍍金池/ 問(wèn)答/HTML/ bootstrap菜單如何點(diǎn)擊另一個(gè)菜單,打開(kāi)的菜單自動(dòng)折疊

bootstrap菜單如何點(diǎn)擊另一個(gè)菜單,打開(kāi)的菜單自動(dòng)折疊

<li class="dropdown">

             <a class="nav-header collapsed" data-toggle="collapse" href="#systemSetting">&nbsp;&nbsp;&nbsp;商品管理
                 <span class="pull-right glyphicon glyphicon-chevron-down"></span>
             </a>
             <!--<ul class="dropdown-menu">-->
                 <ul id="systemSetting" class="nav nav-list collapse secondmenu">
                 <li>
                     <a href="nav1.html" target="mainFrame">商品列表</a>
                 </li>
                 <li>
                     <a href="nav2.html" target="mainFrame">商品類(lèi)別</a>
                 </li>
                 <li>
                     <a href="nav3.html" target="mainFrame">促銷(xiāo)活動(dòng)</a>
                 </li>
             </ul>
         </li>
         <li role="presentation">
             <a class="nav-header collapsed" data-toggle="collapse" target="mainFrame" href="#talk">評(píng)論管理</a>
             <ul id="talk" class="nav nav-list collapse secondmenu">
                 <li>
                     <a href="nav1.html" target="mainFrame">評(píng)論列表</a>
                 </li>
             </ul>
         </li>
         
   

clipboard.png

  點(diǎn)擊商品管理,關(guān)閉評(píng)論管理的子菜單,折疊起來(lái)
回答
編輯回答
嘟尛嘴

仔細(xì)看看文檔collapse的部分呢。

<div id="accordion">
  <div class="card">
    <div class="card-header" id="headingOne">
      <h5 class="mb-0">
        <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Collapsible Group Item #1
        </button>
      </h5>
    </div>

    <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingTwo">
      <h5 class="mb-0">
        <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
        </button>
      </h5>
    </div>
    <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingThree">
      <h5 class="mb-0">
        <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
        </button>
      </h5>
    </div>
    <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordion">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
</div>
2018年5月29日 05:35