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 8210291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:01:23+00:00 2026-06-07T10:01:23+00:00

Below is my code, but I know there is nothing wrong with it, because

  • 0

Below is my code, but I know there is nothing wrong with it, because it works fine when you take it out of the tab. There are also no duplicate Id’s, which I thought might be causing the problem. Anyway, if anyone has any ideas or workarounds that would be great!

<div id="sampleNavbar" class="navbar navbar-static">
    <div class="navbar-inner">
        <div class="container" style="width: auto;">
            <a class="brand" href="#">Project Name</a>
            <ul class="nav">
                <li><a href="#PA">PA</a></li>
                <li><a href="#VT">VT</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="#uno">uno</a></li>
                        <li><a href="#dos">dos</a></li>
                        <li class="divider"></li>
                        <li><a href="#tres">tres</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</div>
<div id="scrollspy-example" data-spy="scroll" data-target="#sampleNavbar" data-offset="300" style="height: 200px; overflow-y: scroll;">
    <h4 id="PA">PA</h4>
    <p>Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
    </p>
    <h4 id="VT">VT</h4>
    <p>Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.
    </p>
    <h4 id="uno">uno</h4>
    <p>Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.
    </p>
    <h4 id="dos">dos</h4>
    <p>In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.
    </p>
    <h4 id="tres">tres</h4>
    <p>Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
    </p>
    <p>Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
    </p>
</div>        
  • 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-07T10:01:26+00:00Added an answer on June 7, 2026 at 10:01 am

    This isn’t a bug in Bootstrap. What’s happening is that, when your page loads, the tab with the scrollspy elements is hidden. As such, when the scrollspy plugin attempts to find the $.position() of each <h4 id="foo"> within your scrolling div, they call return {top: 0, left: 0}. That’s why you see the flickering as you scroll; the plugin thinks all your scroll targets are in the same position.

    If you look at the documentation for the scrollspy plugin, you’ll see that it mentions that if you are adding or removing elements from the DOM, you need to call the .scrollspy('refresh') function so that the plugin can reassess the positions of the various scroll targets.

    That said, what you need to do is wait until the tab with the scrollspy content is loaded, and then call the refresh function, like so. Note that I’ve also combined all the separate click handlers into one handler

    $(function(){
        $('.nav-tabs li a').click(function(e) {
            e.preventDefault();
            $(this).tab('show');
    
            // If we are showing the scrollspy tab, let the
            // plugin refresh itself so it can function properly
            if(this.id === 'scrotab') {
                $(this).on('shown',function(){ 
                    $('#scrollspy-example').scrollspy('refresh'); 
                });
            }
        });
    });
    

    Also, rather than using a data-offset="300" attribute on your <div id="scrollspy-example"> element, you need to set the position of the element to relative with CSS:

    #scrollspy-example {
        position: relative;
    }
    

    Here’s a jsFiddle Demo that works:

    http://jsfiddle.net/GyMYE/3/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know how to do this... I'll give example code below. But I can't
Below code not work, but it's work fine for jsf1.2. Now the framework is
This block of code shown below using a php header redirect works locally, but
I tried below code but as I run it gives a black screen image
How to Remove Badge from the tabbar item i had use below code but
I am newbie to C. I googled alot regarding the output of below code.But
I want to open an xlsx file, I have tried the below code,but neither
I am trying to port the code below to mootools 1.1 code but am
I have tried using the code below but it only display results in Chrome
I have code that looks more or less like the code below but it

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.