带有Affix的Bootstrap Navbar在向下滚动时会丢失高度

时间:2017-09-06 20:11:41

标签: html css twitter-bootstrap scroll

我正在创建一个带有使用词缀的引导程序导航栏的网站,但是当我向下滚动到该点时,导航栏就会转到页面顶部。导航栏失去了它的高度。

如何让导航栏保持高度,所以页面不会崩溃?

我真的不知道如何解释这个非常好,所以这是我的网站,我尝试修复它http://beta.sanderjochems.com/blog

谢谢, Sander Jochems

HTML代码:

({attach}img/forecast1.png)

CSS:

    <div class="top">
      <h1 class="top-title">Sander Jochems</h1>
    </div>

<!-- Header -->

    <nav class="navbar" data-spy="affix" data-offset-top="297">
      <div class="navbar navbar-default navbar-static-top" role="navigation">
        <div class="container container-fluid">
          <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
              <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 accent" href="">Sander Jochems</a>
          </div>
          <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
              <li><a href="/home"><i class="fa fa-home"></i> Home</a></li>
              <li><a href="/projects"><i class="fa fa-list"></i> Projects</a></li>
              <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-android"></i> App Inventor <b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li><a href="/appinventor/extensions">Extensions</a></li>
                  <li><a href="/appinventor/snippets">Snippets</a></li>
                  <li><a href="/appinventor/examples">Examples</a></li>
                </ul>
              </li>
              <li><a href="/portfolio"><i class="fa fa-briefcase"></i> Portfolio</a></li>
              <li class="active"><a href="/blog"><i class="fa fa-book"></i> Blog</a></li>
            </ul>
          </div>
        </div>
      </div>
    </nav>

0 个答案:

没有答案