5
我的目标是添加侧边栏,它开始很好地滚动,但当它靠近页脚时,它开始闪烁。 我做错了什么? 看来,引导未定,并保持在#sidebar
卷轴上的自举侧边字缀闪烁
http://codepen.io/anon/pen/MJMQMr
切换.affix-bottom
JS
var $sidebar = jQuery('#sidebar');
jQuery($sidebar).affix({
offset: {
top: $sidebar.offset().top,
bottom: function() {
return (this.bottom = jQuery('#footer').outerHeight(true))
}
}
})
CSS
.affix {
top: 0;
}
.affix-bottom {
position: absolute;
top: auto;
bottom: 20px;
}
HTML
<div class="container">
<div class="header">
<!-- HEADER -->
</div>
<div class="row">
<div class="content col-md-8">
<!-- CONTENT -->
</div>
<div class="col-md-4">
<div id="sidebar">
<!-- AFFIXED -->
</div>
</div>
</div>
<div id="footer">
<!-- FOOTER -->
</div>
</div>
你可以添加更多关于你对答案做了什么的信息吗? – TehSphinX
我只是把id =“sidebar”放在class =“col-md-4”的div上,查看我编辑它的答案。 –