我不是一个自助专家(根本没有),我有点陷入困境,在另一个无法解决的崩溃中崩溃。
一个简单的崩溃运作良好:
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<li>
<a href="javascript:;" data-toggle="collapse" data-target="#demo"><i class="fa fa-fw fa-sitemap"></i> Vos sites <i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo" class="collapse">
<li>
<a href="/main">Level 1</a>
</li>
</ul>
</li>
&#13;
它给出了这个:
但是当我做同样的事情在这个崩溃树中添加另一个级别时。
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<li>
<a href="javascript:;" data-toggle="collapse" data-target="#demo"><i class="fa fa-fw fa-sitemap"></i> Vos sites <i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo" class="collapse">
<li>
<a href="/main">Level 1</a>
</li>
<li>
<a href="javascript:;" data-toggle="collapse" data-target="#demo_2"><i class="fa fa-fw fa-sitemap"></i> Level 2 <i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo_2" class="collapse">
<li>
<a href="/main"> sublevel1</a>
</li>
<li>
<a href="/main"> sublevel2</a>
</li>
</ul>
</li>
</ul>
</li>
&#13;
奇怪的是它给了这个!
有人可以告诉我为什么我没有和级别1一样显示次级?
COMPLETE
我正在使用Bootstrap 3
答案 0 :(得分:1)
以下是仅引导程序3的工作示例 正如您所看到的,它完全按预期工作:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<ul>
<li>
<a href="javascript:;" data-toggle="collapse" data-target="#demo"><i class="fa fa-fw fa-sitemap"></i> Vos sites <i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo" class="collapse">
<li>
<a href="/main">Level 1</a>
</li>
<li>
<a href="javascript:;" data-toggle="collapse" data-target="#demo_2"><i class="fa fa-fw fa-sitemap"></i> Level 2 <i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo_2" class="collapse">
<li>
<a href="/main"> sublevel1</a>
</li>
<li>
<a href="/main"> sublevel2</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
示例中的颜色显示您使用了一些/一些额外的css文件。