需要在bootstrap.js之后加载bootstrap-dropdown.js以使下拉列表工作 - 为什么? [英] Need to load bootstrap-dropdown.js after bootstrap.js to make dropdown work - why?
问题描述
新引导和 javascript
,并尝试构建一个相当小的下拉菜单示例。我正在使用 bootstrap 2.3.2
这是当前版本。我的IDE中可以看到我的 css
和 js
从 bootstrap
文档中,似乎标准安装 bootstrap.js
包含引导下拉列表.js
,我可以在文件中看到它。但是,我需要下拉菜单中的以下内容:
New to bootstrap and javascript
and was trying to build a fairly minimal example of a dropdown menu. I am using bootstrap 2.3.2
which is the current version. My css
and js
are visible in my IDE. From the bootstrap
docs it seems that a standard install of bootstrap.js
contains bootstrap-dropdown.js
and I can see it in the file. Yet, I need to have the following for the drop down menu to work:
<script src="http://code.jquery.com/jquery.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/bootstrap.js"></script>
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script>
为什么我必须加载 bootstrap-dropdown.js
如果它包含在 bootstrap.js
中,则分开?显然,这里有一些根本不明白的东西。谢谢。
Why do I have to load bootstrap-dropdown.js
separately if it is included in bootstrap.js
? Obviously there is something fundamental here that I don't understand. Thanks.
推荐答案
从Bootstrap网站:
From Bootstrap website :
插件可以单独包含(虽然有些需要
依赖关系),或者一次。 bootstrap.js和bootstrap.min.js
都包含一个文件中的所有插件。
Plugins can be included individually (though some have required dependencies), or all at once. Both bootstrap.js and bootstrap.min.js contain all plugins in a single file.
bootstrap.js
和 bootstrap.min.js
包含一个文件中的所有插件。如果您包含 bootstrap.min.js
或 bootstrap-dropdown.js
> 引导页面中的bootstrap.js ,请查看发送站点。我可以看到你同时包含 bootstrap.min.js
和 bootstrap.js
,但只有一个就足够了。
查看演示此处,只使用 bootstrap.js
。
Both bootstrap.js
and bootstrap.min.js
contain all plugins in a single file. you do not need the bootstrap-dropdown.js
if you include bootstrap.min.js
or bootstrap.js
from the bootstrap page, check this overview on Bootstrap site. i can see that you are including both bootstrap.min.js
and bootstrap.js
but only one is enough.
Check the demo here, only using bootstrap.js
.
此外,您可以从这里下载自定义版本 ,只需根据您的需要,您可以添加组件/插件,然后下载自定义构建。
Also, you can download a customized version from here, just according to your need you can add components/plugins and then download the custom build.
这篇关于需要在bootstrap.js之后加载bootstrap-dropdown.js以使下拉列表工作 - 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!