莫代尔不工作

时间:2013-09-17 08:42:03

标签: javascript jquery twitter-bootstrap twitter-bootstrap-3

我正在使用Bootstrap 3进行个人项目,但是当我添加模态/下拉菜单时,它们不起作用。我查看了代码并且一切正常,所以我假设这是文件链接的问题。

标题链接:

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/carousel.css" rel="stylesheet">

页脚链接:

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">

<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

我也有一个模块,它是Bootstrap网站的精确副本,所有代码都是正确的。

我是否必须删除所有其他本地CSS / JS文件?

可以找到该网站的HTML here

3 个答案:

答案 0 :(得分:0)

据我所知,你还没有加载jQuery-Library。正如Bootstrap的页面所示,你需要jQuery for bootstrap的任何Javascript-Component,see here

确保在Bootstrap Javascript之前加载它,如下所示:

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="//code.jquery.com/jquery.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

然后你应该全部成立。

答案 1 :(得分:0)

您的代码中不包含jquery,只需在 bootstrap.min.js 之前包含jquery.js

 <!-- Core javascript and icons -->
        <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">

        <!-- Optional theme -->
        <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">
        <script src="//code.jquery.com/jquery.js"></script>
        <!-- Latest compiled and minified JavaScript -->
        <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

答案 2 :(得分:0)

查看HTML我可以看到它缺少jquery库路径。请在HTML

中的任何其他JS文件之前将其包含在顶部