下面的内容中的bootstrap下拉导航over / underlap

时间:2015-06-24 06:59:59

标签: html css twitter-bootstrap

这可能很难回答/解释,但是:

为学校项目建立小型网站。使用bootstrap。当屏幕低于780px时,导航栏变为移动设计,单击按钮图标时会出现下拉菜单。

问题是菜单的意思是在打开时推送其下的内容,但它只是在某些页面/我在主页面上的幻灯片下浏览我的内容,并且当内容位于其上时它是无法点击的。

我试图包含所有相关代码,但它完全混乱。由于所有HTML / CSS以及bootstrap和jquery链接都很难在jfiddle中发布。

任何人都可以看到任何错误吗?

以下是问题的屏幕截图:

http://imgur.com/c5WMDZi

HTML:

    <!-- Start of nav bar -->
    <div class="bottomHeader">
        <nav class="navbar navbar-default">
            <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>


            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
              <ul class="nav navbar-nav">
                <li><a href="#">Home</a></li>
                 <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Products<span class="caret"></span></a>
                  <ul class="dropdown-menu" role="menu">
                    <li><a href="#">Action</a></li>
                    <li><a href="#">Another action</a></li>
                    <li><a href="#">Something else here</a></li>
                    <li class="divider"></li>
                    <li><a href="#">Separated link</a></li>
                  </ul>
                </li>   
                <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Services<span class="caret"></span></a>
                  <ul class="dropdown-menu" role="menu">
                    <li><a href="#">Action</a></li>
                    <li><a href="#">Another action</a></li>
                    <li><a href="#">Something else here</a></li>
                    <li class="divider"></li>
                    <li><a href="#">Separated link</a></li>
                  </ul>
                </li>                  
                <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Deals<span class="caret"></span></a>
                  <ul class="dropdown-menu" role="menu">
                    <li><a href="#">Action</a></li>
                    <li><a href="#">Another action</a></li>
                    <li><a href="#">Something else here</a></li>
                    <li class="divider"></li>
                    <li><a href="#">Separated link</a></li>
                  </ul>
                </li>
                <li><a href="#">My Account</a></li>

                <li class="dropdown searchDropDown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Search<span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><form role="search">
                            <input type="text" class="form-control searchBox" placeholder="Search">

                            <button type="submit" class="btn btn-default">Submit</button>
                            </form>
                        </li>
                    </ul>
                </li>
            </ul>
                <!-- SEARCH BUTTON -->
                <div class="searchSection">              
                <form class="searchRight" role="search">
                    <input type="text" class="form-control searchBox" placeholder="Search">
                    <button type="submit" class="btn btn-default">Submit</button>
                </form>
                </div>   

            </div><!-- /.navbar-collapse -->

          </div><!-- /.container-fluid -->
        </nav>
    </div> <!-- end bottom header div -->   
    </div> <!-- end header div -->



    </header>

    <!-- START OF PAGE CONTENT -->
    <content>

    <div class="background">
        <div class="container2">
            <div class="trial"> BOO<br>BOO<br>BOO<br>BOO<br>BOO<br>BOO<br>  
            </div>
        </div>
    </div>



    </content>
</html>

CSS:

.headerBox {
  background-color: #0076a3;
  width: 100%;
  margin: 0 auto;
  height: 115px;
}

.topHeader {
  background-color: transparent;
}

.dellImgBox {
  padding-left: 42px;
  background-color: transparent;
}

.socialMediaBox {
  float: right;
  margin-right: 53px;
  padding-top: 5px; 
}

.smImg {
  background-color: transparent;
  margin-right: 5px;
  display: inline-block;
}
.smImgLeft {margin-left: 30px;}

.socialMediaBox a:hover {
  background: transparent;
}

/******* Bottom Header ********/
.bottomHeader {
  border: 0px solid black;
  background-color: transparent;
  height: 53px;
}
.navbar-default {
  background-color: transparent;
  border: 0px;
}
.navbar-header {
  float: right;
}

.trial {
  margin: 20px 20px;
  border: 1px solid black;
  min-height: 300px;
  color: #444;
}


/* Have nav on right position & display DDmenu */
@media screen and (min-width: 772px) {
  .container > .navbar-header,
  .container-fluid > .navbar-header,
  .container > .navbar-collapse,
  .container-fluid > .navbar-collapse {
    margin-right: 30px;
    margin-left: 0;
    margin-top: -13px;
  }
ul.nav li.dropdown:hover > ul.dropdown-menu {
  display: block;
  }
}

@media screen and (max-width: 771px) {
  .topHeader {display:none;}
  .headerBox {height: 55px;}
  ul.nav.navbar-nav {width: 260px;}
}

/* Hide Main Search input field @ Xwidth */
@media screen and (max-width: 882px) {
  .searchSection {display: none;}
  .searchDropDown {display: block;} 
}
@media screen and (min-width: 883px) {
    .searchDropDown {
    display: none!important;
    }
}

2 个答案:

答案 0 :(得分:2)

在你的CSS文件中,你应该删除height: 53px;,它会起作用。

.bottomHeader {
  border: 0px solid black;
  background-color: transparent;
  height: 53px;
}

更改为:

.bottomHeader {
  border: 0px solid black;
  background-color: transparent;
}

答案 1 :(得分:0)

那是因为你已经覆盖navbar-default课并添加了background-color:transparent。只需评论它,你就可以找到它。

<强> DEMO

.navbar-default {
  /*background-color: transparent;*/
  border: 0px;
  z-index:100000;//Add this property
}