所以我在尝试使用粘性顶部导航实现附加侧边栏时遇到问题,在页面上滚动或单击附加侧边栏时,内容标题偏离 40 像素(被粘性顶部导航覆盖)
基本上,在固定导航下内容没有正确显示。
任何想法在这里如何解决它将不胜感激!
现场示例在这里
http://www.melindayang.com/portfolio-carmax.html
下面冷:
粘性顶部导航
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="aboutme.html">About Me</a>
</li>
<li><a href="document/MYang Resume.pdf"target="_blank">Résumé</a>
</li>
<li><a href="http://melindamcdm.wordpress.com/" target="_blank">Blog</a>
</li>
</ul>
</div>
词缀侧边栏
<div class="col-xs-3" id="myScrollspy">
<ul class="nav nav-tabs nav-stacked" data-spy="affix" data-offset-top="125" id="myNav">
<li class="active">
<a href="#section-1">Summary</a></li>
<li><a href="#section-2">Research</a></li>
<li><a href="#section-3">Ideation</a></li>
<li><a href="#section-4">Prototype</a></li>
<li><a href="#section-5">Results</a></li>
</ul>
</div>
内容
<div class="col-xs-9">
<div id="section-1">
<p> 12345, Content goes here</p>
</div>
<div id="section-2">
<p> 12345, Content goes here</p>
</div>
<div id="section-3">
<p> 12345, Content goes here</p>
</div>
<div id="section-4">
<p> 12345, Content goes here</p>
</div>
<div id="section-5">
<p> 12345, Content goes here</p>
</div>
</div>
JS
<script type="text/javascript">
$(document).ready(function(){
$("#myNav").affix({
offset: {
top: 190
}
});
});