我已经设法让 scrollspy 和 affix 插件正常工作,但是每当用户滚动到页面底部(如果使用小浏览器窗口)时,词缀类就会开始与另一个类发生冲突,并且词缀会在状态之间跳转。
可以在这里看到一个例子:http: //devng.sdss.org/results-science/
CSS是:
.affix-top,.affix{
position: static;
}
#sidebar li.active {
border:0 #eee solid;
border-right-width:5px;
}
@media (min-width: 979px) {
#sidebar.affix-top {
position: static;
margin-top:30px;
}
#sidebar.affix {
position: fixed;
top:70px;
}
#sidebar.affix-bottom {
position: fixed;
bottom: 400px;
}
}
和 JS:
$('#leftCol').affix({
offset: {
top: 235
,bottom: 400
}
});
/* activate scrollspy menu */
var $body = $(document.body);
var navHeight = $('.navbar').outerHeight(true) + 10;
$body.scrollspy({
target: '#leftCol',
offset: navHeight
});
我认为答案就在我面前,但我已经盯着这个太久了,任何额外的眼睛都会非常感激。