bootstrap dropdown won't dropdown

I have implemented a bootstrap navbar on a page and it works as I expect with the exception of one thing. When it is collapsed and the links are condensed into the hamburger menu I get it to drop down. I think I'm missing some variation of class="dropdown-toggle" data-toggle="dropdown" but where do they go? Thanks!

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="content/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="content/custom.css" />
    <script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
        <div class="container">
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <div class="navbar-header"></div>
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>
                <div class="collapse navbar-collapse navbar-right" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li>
                            <p class="navbar-text navbar-right nav-bar-text"><a href="default.aspx" class="navbar-link">Home</a></p>
                        </li>
                        <li>
                            <p class="navbar-text navbar-right nav-bar-text"><a href="Ajax.aspx" class="navbar-link">Ajax Demo</a></p>
                        </li>
                        <li>
                            <p class="navbar-text navbar-right nav-bar-text"><a href="nonAjax.aspx" class="navbar-link">No Ajax Demo</a></p>
                        </li>
                        <li>
                            <p class="navbar-text navbar-right nav-bar-text"><a href="jQuery.aspx" class="navbar-link">jQuery Demo</a></p>
                        </li>
                    </ul>
                </div>
            </nav>
            <asp:ContentPlaceHolder ID="ContentPlaceHolder" runat="server">
            </asp:ContentPlaceHolder>
        </div>
    </form>
</body>
</html>

It looks like you're just missing a reference to bootstrap.js, I added it in this fiddle and it worked.

https://jsfiddle.net/pqhwzrs8/

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
链接地址: http://www.djcxy.com/p/94564.html

上一篇: 导航栏中的Bootstrap(4.0)下拉菜单不能与视口相关

下一篇: 引导下拉菜单不会下拉