Boostrap下拉不起作用

时间:2015-10-27 12:48:59

标签: javascript html twitter-bootstrap

点击它时它不会下降 为什么下拉按钮没有工作? 我使用了here :

找到的bootstrap导航栏

以下是我的代码: 请问你是否需要我的其他任何东西 提前致谢!!

DOCTYPE html>
    <head>
        <title>Unicity</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Latest compiled and minified CSS -->
        <link type="text/css" rel="stylesheet" href="css/bootstrap.css"/>
        <link type="text/css" rel="stylesheet" href="css/bootstrap.min.css"/>
        <link type="text/css" rel="stylesheet" href="css/bootstrap-theme.css"/>
        <link type="text/css" rel="stylesheet" href="css/bootstrap-theme.min.css"/>     
        <link type="text/css" rel="stylesheet" href="style/style.css"/> 
        <script src="U:\Desktop\jihad\unicityv1\js\bootstrap.js"></script>
        <script src="U:\Desktop\jihad\unicityv1\js\bootstrap.js"></script>
        <script src="U:\Desktop\jihad\unicityv1\js\bootstrap.min.js"></script>
        <script src="U:\Desktop\jihad\unicityv1\js\npm.js"></script>
        </head>
    <body>
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#"><img src="U:\Desktop\jihad\unicityv1\images\logo1.png" width="110" class="logo"/>
                    </a>
                </div>

                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li class="active"><a href="#">Home<span class="sr-only">(current)</span></a></li>
                        <li><a href="#">Buy Gold</a></li>
                        <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Sell Gold<span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="#">Runescape3</a></li>
                                <li><a href="#">Oldschool Runecape</a></li>
                                <li><a href="#">Darkscape</a></li>
                            </ul>
                        </li>
                    </ul>
                <form class="navbar-form navbar-left" role="search">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Search">
                    </div>
                    <button type="submit" class="btn btn-default">Submit</button>
                </form>
                    <ul class="nav navbar-nav navbar-right">
                        <li><a href="#">Link</a></li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="#">Action</a></li>
                                    <li><a href="#">Another action</a></li>
                                    <li><a href="#">Something else here</a></li>
                                    <li role="separator" class="divider"></li>
                                    <li><a href="#">Separated link</a></li>
                                </ul>
                            </li>
                    </ul>
                </div>
            </div>
        </nav>

        <div class="container">
            <div class="row">
                <div class="col-sm-4">
                    <h3>Saving your money, we are cheap!</h3>
                    <p>At Unicity we save your money by...</p>
                </div>
                <div class="col-sm-4">
                    <h3>Saving your time, we are fast!</h3>
                    <p> At Unicity we save your time by...</p>
                </div>
                <div class="col-sm-4">
                    <h3>Protecting your information, we are secure!</h3>
                    <p> At Unicity we secure your information are make sure that...</p>
                </div>
            </div>
        </div>
    </body>
</html>

3 个答案:

答案 0 :(得分:0)

演示:https://jsfiddle.net/1rwdc9os/

添加Jquery库文件。

使用bootstrap.css或bootstrap.min.css和bootstrap.min.js或bootstrap.js

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

答案 1 :(得分:0)

我尝试使用您的代码似乎没有代码问题,似乎找不到正确的CSS和Javascript。试试这个,让我知道。

<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> </script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"> </script>
</head>
<body>
<nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#"><img src="U:\Desktop\jihad\unicityv1\images\logo1.png" width="110" class="logo"/>
                </a>
            </div>

            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="#">Home<span class="sr-only">(current)</span></a></li>
                    <li><a href="#">Buy Gold</a></li>
                    <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Sell Gold<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="#">Runescape3</a></li>
                            <li><a href="#">Oldschool Runecape</a></li>
                            <li><a href="#">Darkscape</a></li>
                        </ul>
                    </li>
                </ul>
            <form class="navbar-form navbar-left" role="search">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="Search">
                </div>
                <button type="submit" class="btn btn-default">Submit</button>
            </form>
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="#">Link</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="#">Action</a></li>
                                <li><a href="#">Another action</a></li>
                                <li><a href="#">Something else here</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="#">Separated link</a></li>
                            </ul>
                        </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container">
        <div class="row">
            <div class="col-sm-4">
                <h3>Saving your money, we are cheap!</h3>
                <p>At Unicity we save your money by...</p>
            </div>
            <div class="col-sm-4">
                <h3>Saving your time, we are fast!</h3>
                <p> At Unicity we save your time by...</p>
            </div>
            <div class="col-sm-4">
                <h3>Protecting your information, we are secure!</h3>
                <p> At Unicity we secure your information are make sure that...</p>
            </div>
        </div>
    </div>

答案 2 :(得分:0)

尝试角度......这比其他人更好......

&#13;
&#13;
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
    $scope.names = ["Emil", "Tobias", "Linus"];
});
&#13;
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>

<div ng-app="myApp" ng-controller="myCtrl">

<select ng-model="selectedName" ng-options="x for x in names">
</select>

</div>

<p>This example shows how to fill a dropdown list using the ng-options directive.</p>

</body>
</html>
&#13;
&#13;
&#13;