DarkLeafyGreen
DarkLeafyGreen

Reputation: 70416

Bootstrap scrollspy link active not applied

Fiddle: http://jsfiddle.net/bVLBL/

The class "active" is not applied to the proper link. Any ideas how to fix this?

HTML:

<div data-spy="scroll" data-target="#navbar">
    <div id="navbar" data-spy="affix" class="sticky-nav">
        <ul class="nav inline">
            <li><a href="#introduction">Introduction</a></li>
            <li><a href="#products">Products</a></li>
            <li><a href="#company">Company</a></li>
        </ul>
    </div>
    <div class="sections"> 
        <section id="introduction" name="introduction">Test1</section>
        <section id="products" name="products">Test2</section>
        <section id="company" name="company">Test3</section>
    </div>
</diV>

Upvotes: 2

Views: 8825

Answers (1)

urban_raccoons
urban_raccoons

Reputation: 3499

It seems to work if you assign the data-spy and data-target attributes to a body tag instead of the containing div.

http://plnkr.co/edit/O1244QqRJEOcRfXCCk5J

Upvotes: 5

Related Questions