无法展开导航栏下拉菜单

时间:2015-02-15 12:03:28

标签: html css twitter-bootstrap

我创建了一个包含下拉菜单的导航栏。当我点击标题时,根本没有任何反应。

这是我的代码:

<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand icon-github" href="/"> </a>
        </div>
        <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toogle="dropdown" role="button" aria-expanded="false">
                        Customers
                    <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="/Customers">All Customers</a></li>
                        <li><<a href="/Customers/Recent">Recently added</a></li>
                        <li><a href="/Customers/AppointmentsToday">Today's appointments</a></li>
                        <li class="divider"></li>
                        <li><a href="/Customers/Create">Create new customer</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>

控制台中没有错误。

2 个答案:

答案 0 :(得分:1)

这是一个简单的错字:你有data-toogle而不是data-toggle。 它应该适用于此:

<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
    Customers
<span class="caret"></span>
</a>

答案 1 :(得分:1)

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
    <div class="navbar-header">
        <a class="navbar-brand icon-github" href="/"> </a>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="#" data-toggle="dropdown" class="dropdown-toggle">Coustomers <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                       <li><a href="/Customers">All Customers</a></li>
                    <li><<a href="/Customers/Recent">Recently added</a></li>
                    <li><a href="/Customers/AppointmentsToday">Today's appointments</a></li>
                    <li class="divider"></li>
                    <li><a href="/Customers/Create">Create new customer</a></li>
                    </ul>
                </li>
            </ul>
        </div>
</div>

如果我没有错,这就是你要找的......