Bootstrap词缀总是“跳跃”。 [英] Bootstrap affix is always "jumping"
问题描述
我想在侧边栏上使用bootstrap的affix插件。但是,由于我的网站是响应式的,它总是在某些方面跳跃,我无法让它正常工作。我尝试了这里列出的解决方案:如何在twitter的bootstrap 2.1.0中使用新的词缀插件?但它不仅仅是有效的。
I want to use the affix plugin of bootstrap on my sidebar. However, as my site is responsive, it's always jumping on some dimensions, and I can't get it working properly. I tried the solutions listed here: How to use the new affix plugin in twitter's bootstrap 2.1.0? but it's not just working.
我知道如何在固定宽度的网站上执行此操作,但我的网站 响应
引导文档也是如此,因为它完美地运行那里,我该怎么做达到同样的效果?
I know how I could do this on a site with fixed width, but as my site is responsive and so is bootstrap docs, and as it works perfectly there, how do I achieve the same effect?
因为这可能不会起作用
.affix {
position: fixed;
top: 20px;
right: 10%;
}
推荐答案
当我用过这个,我的 .affix
类只有位置:固定
,没有别的。可以使用 offset
选项在 affix()
方法中设置粘贴元素粘贴的顶部位置,例如
When I've used this, my .affix
class just has position:fixed
, nothing else. The top position at which the affix element becomes affixed can be set in the affix()
method using the offset
option, e.g.
$("#nav_id").affix({
offset: 400
});
这篇关于Bootstrap词缀总是“跳跃”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!