Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollspy target in tab content does not work properly #10675

Closed
wants to merge 1 commit into from

Conversation

literalice
Copy link

When scrollspy's target is set in a tab content, the tab content is forced to be invisible.

<div class="tab-content">
  <div id="scroll-spy-target" class="tab-pane active">
    <ul class="nav">
      <li class="active">...</li>
      <li>...</li>
    </ul>
  </div>
  <div id="not-scroll-spy-target" class="tab-pane">
     ...
   </div>
</div>

In the example, the first tab pane is not visible.

@moodyroto
Copy link
Contributor

This issue appears to be with line 99 of scrollspy.js. Calling .parents('.active') will return all parents with an active class (including the tab pane). Changing this line to .parentsUntil(this.options.target, '.active') should resolve the issue. This will scope the query to only search for active elements inside the scrollspy target.

@fat fat closed this in fc7049b Dec 26, 2013
@fat
Copy link
Member

fat commented Dec 26, 2013

cool thanks @moodyroto

@mdo mdo mentioned this pull request Dec 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants