Bootstrap下拉列表不起作用,似乎没什么用

时间:2013-11-30 21:17:47

标签: jquery twitter-bootstrap

这可能是一个非常简单的修复方法,但我按照许多其他帖子的指示,但是我的下拉菜单仍然无法正常工作。请注意,这是我第一次使用bootstrap。我用javascript控制台测试并得到此错误“未捕获的错误:Bootstrap需要jQuery” - 但我已明确链接jquery .... 这是我的代码

<!DOCTYPE html>
<html lang="en">
<head>
    <link type="text/css" rel="stylesheet" href="css/bootstrap.css">
    <script src="js/bootstrap.js"></script>
    <link type="text/css" rel="stylesheet" href="custom/style.css">
    <script src="http://code.jquery.com/jquery.min.js"></script>
    <title>Bootstrap Proj. 1</title>
</head>
<body>
    <div class="dark top-bar">
        <div class="navbar-brand"></div>
        <ul class="nav nav-tabs">
            <li><a href="#home">Home</a></li>
            <li><a href="#who">Who we are</a></li>
            <li><a href="#what">What we do</a></li>
            <li><a href="#how">How we do it</a></li>
            <li class="dropdown">
                <a class="dropdown-toggle" data-toggle="dropdown"  href="#">Get in touch<span class="caret"></span></a>
                <ul class="dropdown-menu">
                    <li><a href="#">FaceBook</a></li>  
                    <li><a href="#">Twitter</a></li>
                    <li><a href="#">LinkedIn</a>/li>
                    <li><a href="#">Google +</a></li>
                </ul>
            </li>
        </ul>
    </div>    
</body>

1 个答案:

答案 0 :(得分:0)

Order is important

  
    

Bootstrap需要jQuery

  

所以你应该在bootstrap之前加载jquery:

<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>

此外,您可以在JavaScript文件之前包含CSS文件。它并不重要,但它被认为是it speeds up browser rendering time以来的最佳实践。