所以当我尝试使用粘性顶部导航来实现附加侧边栏时遇到问题,当在页面上滚动或点击附加侧边栏时,内容标题会偏离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
}
});
});
答案 0 :(得分:0)