[英]Bootstrap Affix
I'm trying to use Twitter Bootstrap's new affix option, but I can't quite get it right. 我正在尝试使用Twitter Bootstrap的新词缀选项,但我不能完全正确。
I have put together an example at http://jsfiddle.net/yPgUu/1/ and the relevant part is 我在http://jsfiddle.net/yPgUu/1/上放了一个例子,相关部分是
<ul class="nav nav-list" data-spy="affix">
The left nav starts off at the correct position. 左侧导航从正确的位置开始。 However, as you scroll down, then there is a gap at the top of the nav.
但是,当您向下滚动时,导航器顶部会有一个间隙。 I'd like the nav to always be at the top of the current view, instead of being a gap.
我希望导航始终位于当前视图的顶部,而不是间隙。
I've also tried playing around with data-offset-top="200"
, but that just seem to makes the menu bounce around. 我也尝试过使用
data-offset-top="200"
,但这似乎让菜单反弹。
What am I missing? 我错过了什么?
OK, so this needs to be done in two parts. 好的,所以这需要分两部分完成。
http://jsfiddle.net/yPgUu/2/ http://jsfiddle.net/yPgUu/2/
First, assign data-offset-top="50"
and then modify the affix
property in css 首先,分配
data-offset-top="50"
然后修改css中的affix
属性
.affix {
top: 10px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.