我正在为我的网站使用 Zurb Foundation 4 框架。我想要一个导航栏,它位于标题下方,当您滚动过去时,该标题会粘在页面顶部。这很好用,除了当顶部栏粘在页面顶部时页面内容会向上跳跃约 45 像素。可以在此页面上看到效果,尽管这是一个不同的导航元素: http: //foundation.zurb.com/docs/components/magellan.html
有什么办法可以解决这个问题,还是我必须改变我的网站设计来适应这个错误?
文档在这里: http: //foundation.zurb.com/docs/components/top-bar.html
<div class="contain-to-grid sticky">
<nav class="top-bar">
<ul class="title-area">
<!-- Title Area -->
<li class="name">
<h1><a href="/">Top Bar</a></h1>
</li>
<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
</ul>
<section class="top-bar-section">
<ul class="left">
<li class="divider"></li>
<li class="has-dropdown"><a href="/grid.php">Item 1</a>
<ul class="dropdown">
<li><label>Level One</label></li>
<li><a href="#">Sub-item 1</a></li>
<li><a href="#">Sub-item 2</a></li>
<li class="divider"></li>
<li><a href="#">Sub-item 3</a></li>
<li class="has-dropdown"><a href="#">Sub-item 4</a>
<ul class="dropdown">
<li><label>Level Two</label></li>
<li class="has-dropdown"><a href="#">Sub-item 1</a>
<ul class="dropdown">
<li><label>Level Three</label></li>
<li class="has-dropdown"><a href="#">Sub-item 1</a>
<ul class="dropdown">
<li><label>Level Four</label></li>
<li><a href="#">Sub-item 1</a></li>
</ul>
</li>
<li><a href="#">Sub-item 2</a></li>
<li><a href="#">Sub-item 3</a></li>
<li class="divider"></li>
<li><a href="#">Sub-item 4</a></li>
</ul>
</li>
<li><a href="#">Sub-item 2</a></li>
<li><a href="#">Sub-item 3</a></li>
<li><a href="#">Sub-item 4</a>
</ul>
</li>
<li><a href="#">Sub-item 5</a></li>
</ul>
</li>
<li class="divider"></li>
</ul>
<!-- Right Nav Section -->
<ul class="right">
<li class="divider hide-for-small"></li>
<li><a href="#">Item 2</a></li>
</ul>
</section>
</nav>