Twitter Bootstrap崩溃不起作用 [英] Twitter Bootstrap Collapse not working
问题描述
我正在尝试使用twitter bootstrap网站上提供的示例来使工作正常进行。当我尝试这段代码时,单击链接以折叠内容没有任何作用。
这是我的代码:
I'm trying to get collapse to work using the example provided on twitter bootstrap's website. When I try out this code, clicking the link to collapse the content does nothing. Here is my code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test</title>
<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/bootstrap-responsive.css" rel="stylesheet">
<script type="text/javascript" src="../js/bootstrap.js"></script>
</head>
<body>
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Collapsible Group Item #2
</a>
</div>
<div id="collapseTwo" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>
</div>
</body>
</html>
推荐答案
Bootstrap的JavaScript库依赖jQuery。您需要在 bootstrap.js
之前添加该字符,例如
Bootstrap's JavaScript library relies on jQuery. You need to include that before bootstrap.js
, eg
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="../js/bootstrap.js"></script>
请参阅此处的注释- http://getbootstrap.com/2.3.2/getting-started.html#file-structure
请注意,所有JavaScript插件都要求包含jQuery。
Please note that all JavaScript plugins require jQuery to be included.
或现代的等效语言〜 http://getbootstrap.com / getting-started /#jquery-required
需要jQuery
请注意,所有JavaScript插件都需要包含jQuery ,如入门模板。 咨询我们的
bower.json
查看支持的jQuery版本。
jQuery required
Please note that all JavaScript plugins require jQuery to be included, as shown in the starter template. Consult our
bower.json
to see which versions of jQuery are supported.
这篇关于Twitter Bootstrap崩溃不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!