所以我按照本教程了解如何制作垂直多级Bootstrap菜单。到目前为止,一切正常。除了一件事,父项是可点击的,但他们唯一做的就是折叠菜单。我需要能够给他们一个href,例如" / en / boardgames"。
我遵循的教程中的代码:
<div class="container">
<div class="row">
<div class="col-md-3">
<!-- column1, Vertical Dropdown Menu -->
<div id="main-menu" class="list-group">
<a href="#sub-menu" class="list-group-item active" data-toggle="collapse" data-parent="#main-menu">Item 1 <span class="caret"></span></a>
<div class="collapse list-group-level1" id="sub-menu">
<a href="#" class="list-group-item" data-parent="#sub-menu">Sub Item 1</a>
<a href="#" class="list-group-item" data-parent="#sub-menu">Sub Item 2</a>
<a href="#sub-sub-menu" class="list-group-item" data-toggle="collapse" data-parent="#sub-menu">Sub Item 3 <span class="caret"></span></a>
<div class="collapse list-group-level2" id="sub-sub-menu">
<a href="#" class="list-group-item" data-parent="#sub-sub-menu">Sub Sub Item 1</a>
<a href="#" class="list-group-item" data-parent="#sub-sub-menu">Sub Sub Item 2</a>
<a href="#" class="list-group-item" data-parent="#sub-sub-menu">Sub Sub Item 3</a>
</div>
</div>
<a href="#" class="list-group-item">Item 2</a>
<a href="#" class="list-group-item">Item 3</a>
<a href="#" class="list-group-item">Item 4</a>
<a href="#" class="list-group-item">Item 5</a>
</div>
</div>
<div class="col-md-9">
<!-- column 2, content goes here... -->
</div>
</div>
</div>
如您所见,父项包含href =&#34; #sub-menu&#34;,这是使菜单崩溃所必需的。
我想要的是,菜单折叠并且它还链接到&#34; / en / boardgames&#34;等页面。
关于如何做到这一点的任何想法?