2015-07-09 120 views
0

基本上我試圖將bootstrap導航欄轉換爲工具欄。在該工具欄上,我添加了一些帶有下拉菜單的btn組,在媒體查詢崩潰之前它們可以正常工作。一旦它被摺疊,下拉菜單就不能被看到,雖然元素在那裏,並且它會投射它在那裏的影子。如何在崩潰後讓這些下降點顯示出來?摺疊後,Bootstrap btn-group下拉菜單在導航欄中不起作用

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <title> INDEX </title> 

    <link href="bootstrap/css/bootstrap.css" rel="stylesheet"> 
    <link href="mycss/style.css" rel="stylesheet"> 

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> 
    <script type="text/javascript" src="bootstrap/js/bootstrap.js"></script> 
    <script type="text/javascript" src="datepicker/js/bootstrap-datepicker.js"></script> 

    </head> 
    <body> 
    <nav class="navbar navbar-footer"> 
     <div class="navbar-header"> 
     <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#footNav"aria-expanded="false"> 
      <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" href="#">Tool Bar</a> 
     </div> 

     <div class="collapse navbar-collapse" id="footNav"> 

       <!-- 1st btn-group (No Dropdown) --> 

     <div class="btn-group" role="group" aria-label="..." style="margin-right: 7px"> 
      <button type="button" class="btn btn-default">Yesterday</button> 
      <button type="button" class="btn btn-default">Today</button> 
      <button type="button" class="btn btn-default">Tomorrow</button> 
     </div> 

     <!-- 2st btn-group doesn't work after collapse --> 

     <div class="btn-group" role="group" aria-label="..." style="margin-right: 7px"> 
      <div class="btn-group dropup" role="group"> 
      <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 
       Past 
       <span class="caret"></span> 
      </button> 
      <ul class="dropdown-menu"> 
       <li><a href="#">Past</a></li> 
       <li><a href="#">This</a></li> 
       <li><a href="#">Next</a></li> 
      </ul> 
      </div> 
      <button type="button" class="btn btn-default">W</button> 
      <button type="button" class="btn btn-default">M</button> 
      <button type="button" class="btn btn-default">3M</button> 
      <button type="button" class="btn btn-default">Y</button> 
     </div> 

       <!-- 3rd btn-group doesn't work after collapse --> 

     <div class="dropup"> 
      <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 
      Date Range 
      <span class="caret"></span> 
      </button> 
      <ul class="dropdown-menu" aria-labelledby="dropdownMenu2"> 

       <div class="input-group" style="padding-bottom: 4px;"> 
        <span class="input-group-addon" >From:</span> 
        <input class="datepicker" style="height: 30px; width:120px; font-size: 18px; padding:10px;" name="startDate"> 
       </div>   

       <div class="input-group"> 
        <span class="input-group-addon" >To:</span> 
        <input class="datepicker2" style="height: 30px; width:120px; font-size: 18px; padding:10px;" name="endDate"> 
       </div> 
      </ul> 
     </div> 
     </div>   
    </nav> 
    </body> 
</html> 

我用的是標準的引導的東西與CSS的異常改變了

/*Calendar tool Bar*/ 
.navbar { 
    border-radius: 0px; 
} 

.dropup{ 
    display: inline-block; 
} 

.dropdown-menu .input-group .input-group-addon:first-child { 
    width: 63px; 
} 
.dropdown-menu { 
    padding: 4px 4px 4px 4px; 
    min-width: 30px; 
} 
.navbar-footer { 
    background-color: #f8f8f8; 
    border-color: #e7e7e7; 
    position: fixed; 
    bottom: 0px; 
    width: 100%; 
    margin-bottom: 0px; 
    vertical-align: middle; 
} 
.navbar-footer .navbar-toggle:hover, 
.navbar-footer .navbar-toggle:focus { 
    background-color: #ddd; 
} 
.navbar-footer .navbar-toggle { 
    border-color: #ddd; 
} 
.navbar-footer .navbar-toggle .icon-bar { 
    background-color: #888; 
} 
button { 
    margin-top: 8px; 
} 

回答

2

你只需要重寫引導.navbar-collapse.in類使它可見,即使它垂直溢出。

.navbar-collapse.in { 
    overflow-y: visible; 
} 

工作example

相關問題