Bootstrap Dropdown - 移动其他内容

时间:2015-01-15 21:45:02

标签: javascript jquery html css twitter-bootstrap

<!DOCTYPE html>
<!-- saved from url=(0073)http://tutsme-webdesign.info/tutorials/navs/pills_stacked_panesright.html -->
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Bootstrap 3 Navs Tabs Pills</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <!-- Bootstrap core CSS -->
        <link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0-rc2/css/bootstrap.css" rel="stylesheet" media="screen">


        <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
          <script src="http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.2.0/respond.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="container">
            <ul class="nav nav-pills nav-stacked" data-toggle="collapse">
                <li class="dropdown">
                    <a href="" data-toggle="dropdown" class="dropdown-toggle"><span class="glyphicon glyphicon-tree-deciduous"> Nachbarschaft </span><b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li role="presentation"><a href="#hoodProfile">Profil</a></li>
                        <li role="presentation"><a href="#neighbours">Nachbarn</a></li>
                    </ul>
                </li>
                <li role="presentation"><a href="#quests"><span class="glyphicon glyphicon-tasks"> Aufgaben</span></a></li>
            </ul>
        </div><!-- end of container -->
        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
        <script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
        <!-- Include all compiled plugins (below), or include individual files as needed -->
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
    </body>
</html>

如何让第一颗药丸的下拉使下部药丸向下移动?因此,当我点击下拉列表时,我仍然可以看到较低的药丸&#34; Aufgaben&#34;?

JSFiddle示例:http://jsfiddle.net/o0xutq34/ (基于http://tutsme-webdesign.info/tutorials/navs/pills_stacked_panesright.html

提前致谢!

1 个答案:

答案 0 :(得分:3)

您需要将dropdown div静态定位(非绝对)并从中删除float:

.container .dropdown-menu {
    position: static;
    float: none;
}

演示:http://jsfiddle.net/o0xutq34/1/