简体   繁体   中英

Bootstrap Affix

I'm trying to use Twitter Bootstrap's new affix option, but I can't quite get it right.

I have put together an example at http://jsfiddle.net/yPgUu/1/ and the relevant part is

<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.

What am I missing?

OK, so this needs to be done in two parts.

http://jsfiddle.net/yPgUu/2/

First, assign data-offset-top="50" and then modify the affix property in css

.affix {
    top: 10px;
}​

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM