Scrollspy target - Docs unclear? #5553

Closed
bricker opened this Issue Oct 17, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@bricker

bricker commented Oct 17, 2012

Not sure if this is a bug in the JS or the documentation. Let me know and I can submit a patch to whichever one needs it.

From the documentation:

... and data-target=".navbar" to select which nav to use. You'll want to use scrollspy with a .nav component.

That makes me think that I should target the actual .nav element. However, that's not how it works (at least in bootstrap-scrollspy v2.1.0):

Doesn't do anything

<body data-spy="scroll" data-target="#scrollspy-nav">

<ul class="nav nav-list" id="scrollspy-nav">
  <li><a href="#section1">Section 1</a></li>
  <li><a href="#section2">Section 2</a></li>
  <li><a href="#section3">Section 3</a></li>
</ul>

...

</body>

Works as expected

<body data-spy="scroll" data-target="#scrollspy-nav">

<div id="scrollspy-nav">
  <ul class="nav nav-list">
    <li><a href="#section1">Section 1</a></li>
    <li><a href="#section2">Section 2</a></li>
    <li><a href="#section3">Section 3</a></li>
  </ul>
</div>

...

</body>
@fat

This comment has been minimized.

Show comment
Hide comment
@fat

fat Oct 18, 2012

Member

that's because the scrollspy was built to work with the topbar specifically which has a wrapper ul. Feel free to open a pull request with that clarification. thanks!

Member

fat commented Oct 18, 2012

that's because the scrollspy was built to work with the topbar specifically which has a wrapper ul. Feel free to open a pull request with that clarification. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment