2

我在引导站点中使用了代码,但我无法弄清楚如何使下拉菜单起作用。我已阅读此站点上的解决方案,但我找不到看似简单的解决方案。

当我单击计划时,没有任何反应。你能帮助我吗?

这是代码

<!DOCTYPE HTML>

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>Bootstrap Menu Sample</title>

<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</head>

<body>

<div class="navbar navbar-static-top" role="navigation">

    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
        <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" rel="home" href="/" title="Aahan Krish's Blog - Homepage">Brand</a>
    </div>

    <div class="collapse navbar-collapse navbar-ex1-collapse">

        <ul class="nav navbar-nav">

            <li class="active"><a href="#">Home</a></li>
            <li><a href="#">The Artists</a></li>
            <li><a href="#">The Art</a></li>
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Schedule <b class="caret"></b></a>
                <ul class="dropdown-menu unstyled pull-left dropdown-features">
                    <li><a href="#">Day One</a></li>
                    <li><a href="#">Day Two</a></li>
                    <li><a href="#">Day Three</a></li>
                </ul>
            </li>
            <li><a href="#">Venue</a></li>
            <li><a href="#">Hotels</a></li>
        </ul>

        <div class="col-sm-3 col-md-3 pull-right">
        <form class="navbar-form" role="search">
        <div class="input-group">
            <input type="text" class="form-control" placeholder="Search" name="srch-term" id="srch-term">
            <div class="input-group-btn">
                <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
            </div>
        </div>
        </form>
        </div>

</body>
</html>
4

1 回答 1

1

Possible incorrect paths to javascripts.

Try this. It the same but point to CDN. All works.

Also possible that your local bootstrap.min.js does not include dropdown.js.

<!DOCTYPE HTML>

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>Bootstrap Menu Sample</title>

<link rel="stylesheet" href="bootstrap.min.css">
<script src="http://codeorigin.jquery.com/jquery-1.10.2.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
</head>

<body>

<div class="navbar navbar-static-top" role="navigation">

    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
        <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" rel="home" href="/" title="Aahan Krish's Blog - Homepage">Brand</a>
    </div>

    <div class="collapse navbar-collapse navbar-ex1-collapse">

        <ul class="nav navbar-nav">

            <li class="active"><a href="#">Home</a></li>
            <li><a href="#">The Artists</a></li>
            <li><a href="#">The Art</a></li>
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Schedule <b class="caret"></b></a>
                <ul class="dropdown-menu unstyled pull-left dropdown-features">
                    <li><a href="#">Day One</a></li>
                    <li><a href="#">Day Two</a></li>
                    <li><a href="#">Day Three</a></li>
                </ul>
            </li>
            <li><a href="#">Venue</a></li>
            <li><a href="#">Hotels</a></li>
        </ul>

        <div class="col-sm-3 col-md-3 pull-right">
        <form class="navbar-form" role="search">
        <div class="input-group">
            <input type="text" class="form-control" placeholder="Search" name="srch-term" id="srch-term">
            <div class="input-group-btn">
                <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
            </div>
        </div>
        </form>
        </div>

</body>
</html>
于 2013-09-28T15:15:37.363 回答