0

我遇到了 twitter bootstrap 下拉菜单的问题,我需要帮助来解决这个问题。我是使用引导程序的初学者。在此先感谢您的帮助。

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css">
<script src="js/jquery-1.10.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-dropdown.js"></script>

<div class="container">
    <div class="row">
        <div class="span12">
            <nav class="navbar">
                <div class="navbar-inner">
                    <a href="#" class="brand">brand</a>
                    <ul class="nav">
                        <li><a href="home.php">Home</a></li>
                        <li><a href="home.php">Home</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">connect
                                <b class="caret"></b>
                            </a>

                            <ul class="dropdown-menu">
                                <li><a href="#">home</a></li>
                            </ul>

                        </li>
                    </ul>
                </div>
            </nav>
        </div>
    </div>
</div>
4

2 回答 2

0

Attach application.js file to your js declarations in head... As far as you declared bootstrap.min.js and bootstrap-dropdown.js, bootstrap.min.js have js of all the element js of all the JavaScript entitles of twitter bootstrap, so need to attach bootstrap-dropdown.js...

Also use jquery latest version of code...

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/application.js"></script>

Here's your working demo:- http://jsfiddle.net/eGLMm/

Thanks...

于 2013-06-01T06:03:11.990 回答
0

在关闭头标签之前使用它

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/bootstrap-responsive.min.css">

然后是html部分

    <div class="navbar navbar-inverse"> 
        <div class="navbar-inner">  
        <div class="container">   
         <a class="btn btn-navbar" data-toggle="collapse" data-target=".navbar-inverse-collapse">
          <span class="icon-bar"> </span>
          <span class="icon-bar"> </span>
          <span class="icon-bar"> </span>
        </a>   
     <a href="pages/" class="brand"> Expense Manager</a>

      <div class="nav-collapse collapse navbar-inverse-collapse">  
            <ul class="nav ">   
                <li class="dropdown ">  <a href="users" class="dropdown-toggle" data-toggle="dropdown"> Users <i class="caret"> </i> </a>
                    <ul class="dropdown-menu mydropdown">   
                        <li> <a href="users/add" class="linkmain"> Add Users </a> </li>
                        <li> <a href="users/" class="linkmain"> Manage Users </a> </li>
                    </ul>  
                </li>
                <li class="dropdown "><a href="users" class="dropdown-toggle" data-toggle="dropdown"> Users <i class="caret"> </i> </a>
                    <ul class="dropdown-menu mydropdown">   
                        <li> <a href="users/add" class="linkmain"> Add Notes </a> </li>
                        <li> <a href="users/" class="linkmain"> Manage Notes </a> </li>
                    </ul> 
                </li>
            </ul>  
            <ul class="nav pull-right">   
                <li class="active"> <a href="users/login"> Login to add your expense </a></li>
            </ul>   
     </div>
    </div> 
</div>
</div>

在此处阅读教程并在此处查看实时演示

于 2014-08-28T19:49:26.063 回答