2017-11-04 143 views
0

我創建Bootstrap導航欄內有dropdown-item,但菜單本身無法默認隱藏。導航欄DropDown項目默認情況下不能隱藏

請看到的影像,點擊之前(默認值): enter image description here

點擊後:

enter image description here

我的代碼:

<nav class="navbar navbar-expand-lg navbar-light bg-primary"> 
<div class="navbar-brand"> 
    <img src="img/logo.png" /> 
</div> 

<div class="collapse navbar-collapse"> 
    <div class="navbar-nav flexbox_basic-spaceAround border-yellow"> 


     <div class="nav-item dropdown"> 
      <a class="nav-link dropdown-toggle" 
       href="#" id="navbarDropdown" 
       role="button" 
       data-toggle="dropdown" 
       aria-haspopup="true" 
       aria-expanded="false"> 
       Stores 
      </a> 
      <div id="menu1" class="dropdown-menu" aria-labelledby="navbarDropdown"> 
       <a class="dropdown-item" href="#">Action</a> 
       <a class="dropdown-item" href="#">Another action</a> 
       <div class="dropdown-divider"></div> 
       <a class="dropdown-item" href="#">Something else here</a> 
      </div> 
     </div> 

     <div class="nav-item">Custom Order</div> 
     <div class="nav-item">Industry</div> 
     <div class="nav-item">Business</div> 

     <div class="nav-item"> 
      <button class="bg-primary"> 
       <span class="navbar-toggler-icon"></span> 
      </button> 
     </div> 
    </div> 
</div> 

CSS(I」米使用Flexbox的CSS3):

.flexbox_basic-spaceAround { 
    display: flex; 
    flex-direction: row; 
    flex-grow: 1; 
    justify-content: space-around; 
    align-items: center; 
} 

.flexbox_basic-spaceAround div { 
    display: flex; 
} 

我使用的自舉4-β-2 BTW ...

任何想法?

在此先感謝

回答

0

首先你應該給顯示:無使用類名稱下拉菜單中, 點擊後/上的菜單按鈕的懸停給顯示DIV:爲下拉菜單DIV