bootstrap scrollspy不工作

San*_*eep 5 twitter-bootstrap twitter-bootstrap-2

这就是我面临的问题.

http://bittu.github.com/folderGrid/

它首先突出显示最后一个选项卡,当滚动时,它在每个滚动步骤上仅在两个标签之间切换.

这是我使用的一小段代码.

<body data-spy="scroll" data-target=".subnav" data-offset="50">

<div class="subnav">
    <ul class="nav nav-pills">
        <li><a href="#contents">Contents</a></li>
        <li><a href="#config">Config Options</a></li>
        <li><a href="#usage">Usage</a></li>
        <li><a href="#examples">Examples</a></li>
    </ul>
</div>

<div class="row">
    <div class="span12">
        <section id="contents">
            ....
        </section>
        <section id="config">
            ....
        </section>
        <section id="usage">
            ....
        </section>
        <section id="examples">
            ....
       </section>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

包括所有必要的文件.并尝试了所有数字data-offset

Mar*_*ski 0

Twitter 的引导程序没有定义subnav类。Twitter 的 Bootstrap 页面中提供了它,但要重用它,您必须包含其CSS中的一些代码。它是专为该特定页面设计的。Subnav 在滚动时固定位置,要了解它是如何工作的,请查看 CSS 和JS