【发布时间】:2013-02-20 02:45:50
【问题描述】:
我已经阅读了文档,我觉得我所做的正是他们在示例中展示的内容。然而,当我尝试它时,我无法让它工作。我希望它以类似于文档的方式工作。滚动经过页眉后变为position:fixed,然后一旦触及页脚,它变为position:absolute 并粘在底部。
演示:http://jsfiddle.net/uvnGP/1/
JS
$("#account-overview-container").affix({
offset: {
top: $("header").outerHeight(true),
bottom: $("footer").outerHeight(true)
}
});
SASS
#account-overview-container {
&.affix{
top:10px;
bottom:auto;
}
&.affix-top{
//Do I need this?
}
&.affix-bottom{
position:absolute;
top:auto;
bottom:140px;
}
}
【问题讨论】:
-
我遇到了同样的问题。一旦它到达底部约束,我会看到一个闪烁,并注意到它在“affix”和“affix-bottom”之间快速来回移动。你有想过吗?
-
不确定是否有解决方案。这个问题似乎被完全忽略了。
-
如果您使用的是 bootstrap 3,则在 master 中修复了一个错误,但尚未发布:github.com/twbs/bootstrap/commit/…
标签: javascript jquery css twitter-bootstrap affix