0

I have a affix part on page, it keep some distance from the window's top,

What I want is, when the page scroll, it will scroll too, but when it touch the window's top, it will fixed in that position

I have use data-spy="affix", but it does't succss, here is the demo

How can I achieve that?

4

1 に答える 1

0

これをチェックしてください:http://jsfiddle.net/panchroma/v9xqw/4/

この行を編集しました

<div class="demo" data-spy="affix" data-offset-top="260"></div> <!-- data-offset-top is the distance you need to scroll before the demo div is affixed -->

これをCSSに追加しました

.demo.affix  
{           /* specify what you want to happen when the demo div is affixed */
top:0;
}

それがあなたのためのトリックをすることを願っています!

于 2013-01-04T15:29:46.030 に答える