bootstrap jquery 没有崩溃
bootstrap jquery not collapsing
我正在尝试创建一个面板,当我单击标题时,会打开下面的说明。
我正在使用 jQuery 2.1.4 和 Bootstrap 3.3.4.
我在网上找到了一些代码。然而,当我在我的计算机上测试它时(本地,使用 Brackets),折叠的切换不起作用。
我尝试将此代码放入 Bootply(jQuery 和 Bootstrap 的版本相同)以查看它是否有效。
然后我在本地再次尝试,并创建了一个新页面,其代码与 Bootply 上的代码完全相同(因为我认为可能是我的代码的另一部分造成了问题)。但是还是不行。
这是 Bootply:
http://www.bootply.com/D5UHnGjtU5
这是我在本地创建的页面:
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- jQuery 2.1.4 --><script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.4 --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- FontAwesome 4.3.0 --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<div class="container-fluid">
<div class="row row-content">
<div class="col-md-2"></div>
<div class="col-md-4">
<div class="accordion" id="Education">
<div class="panel">
<a data-toggle="collapse" data-parent="#Education" data-target="#Education1">Education 1<i class="fa fa-angle-double-right pull-left"></i></a>
<div id="Education1" class="collapse">
<p>Test</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
我真的不知道为什么它在 Bootply 上工作而不是在本地工作。我在 header.
中包含了 jQuery(首先),然后是 Bootstrap
我也试过直接把它放在 Apache 服务器上(我想也许 Brackets 服务器有什么问题),但还是不行。
代码有什么问题吗,还是配置(或兼容性)问题?
Codeply 使用 bootstrap 3.2.0。和 jquery 2.1.0,确保你也使用它们。
*编辑:检查您的本地代码后,您似乎还需要添加此脚本:https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js
我正在尝试创建一个面板,当我单击标题时,会打开下面的说明。 我正在使用 jQuery 2.1.4 和 Bootstrap 3.3.4.
我在网上找到了一些代码。然而,当我在我的计算机上测试它时(本地,使用 Brackets),折叠的切换不起作用。
我尝试将此代码放入 Bootply(jQuery 和 Bootstrap 的版本相同)以查看它是否有效。
然后我在本地再次尝试,并创建了一个新页面,其代码与 Bootply 上的代码完全相同(因为我认为可能是我的代码的另一部分造成了问题)。但是还是不行。
这是 Bootply: http://www.bootply.com/D5UHnGjtU5
这是我在本地创建的页面:
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- jQuery 2.1.4 --><script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.4 --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- FontAwesome 4.3.0 --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<div class="container-fluid">
<div class="row row-content">
<div class="col-md-2"></div>
<div class="col-md-4">
<div class="accordion" id="Education">
<div class="panel">
<a data-toggle="collapse" data-parent="#Education" data-target="#Education1">Education 1<i class="fa fa-angle-double-right pull-left"></i></a>
<div id="Education1" class="collapse">
<p>Test</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
我真的不知道为什么它在 Bootply 上工作而不是在本地工作。我在 header.
中包含了 jQuery(首先),然后是 Bootstrap我也试过直接把它放在 Apache 服务器上(我想也许 Brackets 服务器有什么问题),但还是不行。
代码有什么问题吗,还是配置(或兼容性)问题?
Codeply 使用 bootstrap 3.2.0。和 jquery 2.1.0,确保你也使用它们。
*编辑:检查您的本地代码后,您似乎还需要添加此脚本:https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js