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

  • Home
  • SEARCH
  • 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 814603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:32:53+00:00 2026-05-15T01:32:53+00:00

I don’t understand why the vertical scroll bar moves automatically to the most top

  • 0

I don’t understand why the vertical scroll bar moves automatically to the most top position when “Line 9” clicked, for example. Further clicks does not move the scroll bar. Could anyone explain why, and how to fix this ?
I work with Firefox 3.6.3.

HTML:

<html>
    <head>
        <link rel="stylesheet" href="test.css" type="text/css" />
        <script src="http://code.jquery.com/jquery-latest.js"></script>
        <script language="JavaScript" src="test.js"></script>
    </head>

    <body>
        <div>
            <table>
                <tr row='0'><td class='column1'>Line 0</td></tr>
                <tr row='1'><td class='column1'>Line 1</td></tr>
                <tr row='2'><td class='column1'>Line 2</td></tr>
                <tr row='3'><td class='column1'>Line 3</td></tr>
                <tr row='4'><td class='column1'>Line 4</td></tr>
                <tr row='5'><td class='column1'>Line 5</td></tr>
                <tr row='6'><td class='column1'>Line 6</td></tr>
                <tr row='7'><td class='column1'>Line 7</td></tr>
                <tr row='8'><td class='column1'>Line 8</td></tr>
                <tr row='9'><td class='column1'>Line 9</td></tr>
            </table>
        </div>
    </body>
</html>

JS:

$(document).ready(function() {
    $(".column1").each(function(index) {
        $(this).after("<td class='column2'>Details " + index + "</td>");
        $(this).toggle(function() { $("[row='" + index + "'] .column2").fadeIn("fast") },
                       function() { $("[row='" + index + "'] .column2").fadeOut("fast") });
    });
});

CSS:

div {
    overflow: auto;
    height: 100px;
    width: 300px;
    border: 1px solid blue;
}

.column1 {
    cursor: pointer;
    width: 100px;
    background-color: green;
    color: white;
}

.column2 {
    display: none;
    width: 200px;
    background-color: blue;
    color: white;
}
  • 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-05-15T01:32:54+00:00Added an answer on May 15, 2026 at 1:32 am

    After doing some trial and error tests, it looks like this is related to the moment that the browser recalculates and redraws the table when you fade in/fade out one of the cells. There’s nothing wrong with your code, and jQuery is correctly toggling the ‘display’ property of the cell – it looks like it’s a minor bug in FF.

    Probably the easiest way around it is to avoid toggling table cells themselves, and instead toggle the contents of the column2 cell, like so:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
        <head>
            <link rel="stylesheet" href="test.css" type="text/css" />
            <script src="http://code.jquery.com/jquery-latest.js"></script>
            <script language="JavaScript">
            $(document).ready(function() {
                $("td.column1").each(function(index) {
                    $(this).after('<td class="column2"><span class="details">Details ' + index + '</span></td>');
                    $(this).toggle(
                      function(){$(this).siblings('.column2').children('span.details').fadeIn("fast")},
                      function(){$(this).siblings('.column2').children('span.details').fadeOut("fast")}
                    ) 
                });
            });
            </script>
            <style type="text/css" media="screen">
              div {
                  overflow: auto;
                  height: 100px;
                  width: 300px;
                  border: 1px solid blue;
              }
    
              .column1 {
                  cursor: pointer;
              }
    
              .column2 .details{
                  display:none;
              }
    
            </style>
        </head>
    
        <body>
            <div>
                <table>
                    <tr row='0'><td class='column1'>Line 0</td></tr>
                    <tr row='1'><td class='column1'>Line 1</td></tr>
                    <tr row='2'><td class='column1'>Line 2</td></tr>
                    <tr row='3'><td class='column1'>Line 3</td></tr>
                    <tr row='4'><td class='column1'>Line 4</td></tr>
                    <tr row='5'><td class='column1'>Line 5</td></tr>
                    <tr row='6'><td class='column1'>Line 6</td></tr>
                    <tr row='7'><td class='column1'>Line 7</td></tr>
                    <tr row='8'><td class='column1'>Line 8</td></tr>
                    <tr row='9'><td class='column1'>Line 9</td></tr>
                </table>
            </div>
        </body>
    </html>
    

    So, the script adds the column2 cell, and that stays visible the whole time – instead we show/hide the <span class="details"> within it. I’ve tested this version in FF 3.6.3 and it behaves as it should!

    Oh – and I cleaned up your jQuery selectors for better performance. If you want more info on why, let me know!

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

Sidebar

Related Questions

I don't understand where the extra bits are coming from in this article about
I don’t think I’ve grokked currying yet. I understand what it does, and how
I don't know when to add to a dataset a tableadapter or a query
I don't edit CSS very often, and almost every time I need to go
I don't want PHP errors to display /html, but I want them to display
I don't remember whether I was dreaming or not but I seem to recall
I don't expect a straightforward silver bullet answer to this, but what are the
I don't want to take the time to learn Obj-C. I've spent 7+ years
I don't know if anyone has seen this issue before but I'm just stumped.
I don't currently use ajax.net though I would be open to it if 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.