Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8635957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:06:08+00:00 2026-06-12T10:06:08+00:00

I have a nav menu bar based on twitter bootstrap that uses scrollspy to

  • 0

I have a nav menu bar based on twitter bootstrap that uses scrollspy to for hightlighting.

this works by matching the value after the # in a link (e.g. <a href="#foo"> when <div id="foo"> scrolls into view). pretty basic, here’s the doco: http://twitter.github.com/bootstrap/javascript.html#scrollspy

my problem comes when I introduce a link to a bootstrap modal dialogue box within an element that is being spied on. imagine I have:

<ul class="nav">
  <li><a href="#info">a link</a></li>
  <li><a href="#demo" role="button" data-toggle="modal">modal</a></li>
  <li><a href="#products">a different link</a></li>
</ul>
<p> .. my page .. </p>
<div id="info"><a name="info"></a>info on my product</div>
<div id="products"><a name="products"></a>a list of my products</div>
<div class="modal hide fade" id="demo" tabindex="-1" role="dialog">
  <div class="modal-header">my header</div>
  <div class="modal-body">some content</div>
  <div class="modal-footer"><button>close</button></div>
</div>
<p> .. more page </p>

the div that represents my modal overlay also uses the #id-of-target format for its href, but since it’s included inside the nav (of course) then scrollspy ALSO highlights when the (hidden) div is in view. Depending on where the modal code in on the page, this confuses the menu system’s highlighting.

I can see that scrollspy should be modified to only link to items that are visible (and therefore not activate when “demo” scrolls into view) but can’t work out how to modify the plugin to only fire if the element is visible, or override the event some other way.

can anyone give me some pointers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:06:09+00:00Added an answer on June 12, 2026 at 10:06 am

    funny how typing out a question sometimes makes you think in the right way to solve it, where just thinking about it does not.

    to make this work, I modified the scrollspy component of bootstrap so that it tests the target is hidden and bails out of the activate routine (also doesn’t raise the activated event, since it’s not active)

    here it is: around line 1432 for me (+if ..

    , activate: function (target) {
        var active
          , selector
    
         if (target.is(":hidden")) return 
    
        this.activeTarget = target
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nav menu bar based on twitter bootstrap that I want to
I have a nav bar that has a dropdown menu made with styled tags.
I have a twitter bootstrap nav bar, but evertime I navigate on a link
Using twitter bootstrap. on the site i have a top nav bar consisting of
I have a menu set up this way: <div id='top-navigation'> <ul> <li><a class='top-nav-button-unclicked' href='#'>SUBJECT</a></li>
I would like to have a search box integrated into a nav bar that
I have a drop down menu in my nav bar but it has quite
I have to build a WordPress theme based on Twitter Bootstrap. For now I've
I am trying to make a CSS based nav bar that converts a UL/LI
i have this div for my menu bar, here what i want is: <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.