内容与移动Safari中的绝对引导导航栏重叠

时间:2014-12-15 12:14:25

标签: jquery html css twitter-bootstrap

我正在使用bootstrap导航栏。我用它作为绝对位置。它在Android浏览器上运行良好但是当我在移动safari上测试时,导航栏隐藏在内容下面。

 <ul class="nav navbar-nav navbar-absolute">
                        <li class="selectView leadsBoard">
                            <a class="tabContainer" href="#/board/leads/<%=id%>">
                                <span class="tabImage leads"></span>
                                <span class="tabText">Leads</span>
                            </a>
                        </li>


                            <li class="selectView competitors">
                                <a class="tabContainer" href="#/board/competitors/<%=id%>">
                                    <span class="tabImage competitors"></span>
                                    <span class="tabText">Competitors</span>
                                </a>
                            </li>   

                        <li class="selectView sources">
                            <a class="tabContainer" href="#/board/sources/<%=id%>">
                                <span class="tabImage data"></span>
                                <span class="tabText">Data</span>
                            </a>
                        </li>                   
    </ul>

.nav.navbar-nav.navbar-absolute{
    position: absolute;
    width: 100%;
    background: #fff;
    z-index: 1057;
    margin: -6px -@navbar-padding-horizontal;
    border: 1px solid #888;
    border-top: none;
  }

enter image description here

1 个答案:

答案 0 :(得分:1)

我看到你IMG,首先我不知道你为什么使用导航栏的绝对位置?

这是更简单的解决方案

 <!-- Fixed navbar -->
    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
        <div class="row">
    <div class="col-md-12 text-center" style="background-color:red;">
        HELE GOES CONTENT
            </div>
        </div>
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <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="#">Project name</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#contact">Contact</a></li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <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 class="dropdown-header">Nav header</li>
                <li><a href="#">Separated link</a></li>
                <li><a href="#">One more separated link</a></li>
              </ul>
            </li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="../navbar/">Default</a></li>
            <li><a href="../navbar-static-top/">Static top</a></li>
            <li class="active"><a href="./">Fixed top <span class="sr-only">(current)</span></a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </nav>

工作小提琴 http://jsfiddle.net/DTcHh/2633/