导航栏中的booststrap下拉列表无法正常工作

时间:2017-05-02 14:57:22

标签: asp.net twitter-bootstrap drop-down-menu

我有通过bootstrap制作的导航栏,在我运行项目后出现所有导航栏项目但是当我点击它时“下拉列表”项目不起作用  我有这个标题:

    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery-3.2.1.min.js"></script>
    <link href="css/Style.css" rel="stylesheet" /><meta name="viewport" content="width=device-width, initial-scale=1" />

这是导航条代码

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

<link href="css/Style.css" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1" />


<nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="Default.aspx">MHM CAMM</a>
    </div>
    <ul class="nav navbar-nav">
      <li class="active"><a href="Default.aspx">Home</a></li>
      <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Convert<span class="caret"></span></a>
        <ul class="dropdown-menu">
          <li><a href="#">Currency</a></li>
          <li><a href="#">Mass Measurements</a></li>
        </ul>
      </li>
      <li><a href="#">About</a></li>
      <li><a href="#">Login</a></li>
    </ul>
  </div>
</nav>

当我点击转换按钮时,下拉列表不会显示 我的项目使用asp.net,IDE是VS2017
如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

你的图书馆的顺序是错误的。必须在boostrap之前使用jQuery:

&#13;
&#13;
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>




<nav class="navbar navbar-inverse">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="Default.aspx">MHM CAMM</a>
        </div>
        <ul class="nav navbar-nav">
            <li class="active"><a href="Default.aspx">Home</a></li>
            <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Convert<span class="caret"></span></a>
                <ul class="dropdown-menu">
                    <li><a href="#">Currency</a></li>
                    <li><a href="#">Mass Measurements</a></li>
                </ul>
            </li>
            <li><a href="#">About</a></li>
            <li><a href="#">Login</a></li>
        </ul>
    </div>
</nav>
&#13;
&#13;
&#13;