Scrollbars appear when clicking a Javascript link in IE

Discussion in 'Javascript' started by Andrew Phillipo, Sep 5, 2005.

  1. I have a layout which works perfectly. It is three column, the central
    column is width:auto; with margins and the columns are absolutely
    positioned at top:0px; left:0px; and top:0px;right:0px;

    In the right column I have a javascript link which hides the column.
    This is very necessary due to the width of content shown on the site at
    times.

    Clicking the link makes the scrollbars appear for no aparent reason -
    both horizontal by about 1px and vertical by about 10px - even if you
    completely remove the functionality of the javascript function executed
    by clicking (i.e. it becomes an empty function).

    Does anyone have a clue as to what this might be caused by.

    Thanks kindly,

    Andy.
    Andrew Phillipo, Sep 5, 2005
    #1
    1. Advertising

  2. Andrew Phillipo

    Lee Guest

    Andrew Phillipo said:

    >In the right column I have a javascript link which hides the column.
    >This is very necessary due to the width of content shown on the site at
    >times.
    >
    >Clicking the link makes the scrollbars appear for no aparent reason


    It probably depends on what, exactly, you're calling a "javascript link".
    Lee, Sep 5, 2005
    #2
    1. Advertising

  3. Andrew Phillipo

    Randy Webb Guest

    Dr Clue said the following on 9/5/2005 3:24 PM:

    > When you hide the column , also move it to some -500px ,-500px or such
    > so that it's width will not go outside the right / bottom of the screen
    > Then when you show the column again make sure to move the layer back
    > before making it visible.
    >
    > Then again , you could skip the visibility all togeather , and just move
    > it on and off screen as need.
    >
    > Doing this will make the scrollbars leave you alone.


    Or, just set it's display to none which takes it out of the page flow.....

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Answer:It destroys the order of the conversation
    Question: Why?
    Answer: Top-Posting.
    Question: Whats the most annoying thing on Usenet?
    Randy Webb, Sep 5, 2005
    #3
  4. Thanks for your responses - problem is - even if I make the link
    something like this there is still a problem:

    <script type="text/javascript">

    function righthide() {
    // intentionally left blank
    }

    function voidfn() { ; }

    </script>
    ....
    <body>
    ....

    <div id="right">
    <a href="javascript:voidfn();" onclick="righthide();">hide</a>
    </div>

    ....
    </body>
    ....

    as you can understand this VERY weird. Any more advice appreciated!
    Andrew Phillipo, Sep 5, 2005
    #4
  5. Andrew Phillipo

    RobG Guest

    Andrew Phillipo wrote:
    [...]

    > as you can understand this VERY weird. Any more advice appreciated!


    I can't replicate your issue at all. Your problem may have nothing at
    all to do with JavaScript, try asking your question in:

    comp.infosystems.www.authoring.stylesheets.

    They wil likely want a link to a page that shows the issue - the
    snippets of CSS and script posted here will not suffice.



    --
    Rob
    RobG, Sep 6, 2005
    #5
  6. Andrew Phillipo wrote:
    > Thanks for your responses - problem is - even if I make
    > the link something like this there is still a problem:
    >
    > <script type="text/javascript">
    >
    > function righthide() {
    > // intentionally left blank
    > }
    >
    > function voidfn() { ; }
    >
    > </script>
    > ...
    > <body>
    > ...
    >
    > <div id="right">
    > <a href="javascript:voidfn();" onclick="righthide();">hide</a>
    > </div>
    >
    > ...
    > </body>
    > ...
    >
    > as you can understand this VERY weird.


    If scrollbars appear when you activate the link you would imagine that
    the page has become larger, maybe because some of its contents become
    larger. This is the sort of question that is best resolved with a
    minimal test case that shows the complete code. You have not provided
    enough for anyone else to reproduce, or examine, the behaviour, so you
    may never get to fully understand what is happening.

    However, if the effect is observed when all the functions called do
    nothing it cannot be the action of your code that causes the symptoms.

    There are two possible state changes that may follow from clicking on a
    link. The first is that the link will go from its normal (or 'hover')
    state to an 'active' state, which is often styled differently, and so
    may be a larger size. This is unlikely, as browser's default style
    sheets do not tend to change the style of links in a way that would
    result in them being larger when 'active'.

    The other state change follows from the act of executing a javascript
    pseudo-protocol HREF. It appears that many browsers respond to the use
    of a javascript pseudo-protocol HREF in the same way as they respond to
    navigation, putting the browser into a 'waiting' state in anticipation
    of the contents of the page being replaced in the near future. Of course
    when a javascript pseudo-protocol does not result in the replacement of
    the current page this new state is not terminated by the arrival of a
    replacement page.

    This waiting state has numerous diverse symptoms across different
    browsers. The most demonstrable one being on Windows IE, where animated
    GIF images stop animating at the point of activation of a javascript
    pseudo-protocol. But much other unexpected behaviour has been identified
    as following from the execution of javascript pseudo-protocol HREF.

    However, to date I have never seen the appearance of scrollbars being
    attributed to this cause. But that is not necessarily significant as an
    awareness of this state change, and other issues with the use of the
    pseudo-protocol in HREFs that do not result in the replacement of the
    current page, results in the standard advice being to never use a
    javascript pseudo-protocol HREF, and avoiding their use entirely acts
    against being able to become familiar with the full spectrum of
    symptoms.

    It remains the sort of question that can only be finally resolved with a
    complete, minimal test-case page, and details of which environment(s)
    exhibit the symptoms.

    > Any more advice appreciated!


    There are long established conventions in the construction and
    formatting of newsgroup posts. They are outlined in this group's FAQ,
    and disregarding them will result in your posts being disregarded, and
    particularly by a significant proportion of the contributors to this
    group who are capable of providing the best informed advice. You would
    be well advised to become familiar with those conventions, and use them
    when posting to the group.

    Richard.
    Richard Cornford, Sep 6, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. loga123
    Replies:
    9
    Views:
    7,614
    loga123
    Jun 8, 2006
  2. Troy Piggins
    Replies:
    1
    Views:
    463
    Troy Piggins
    Sep 9, 2007
  3. 123Jim
    Replies:
    0
    Views:
    483
    123Jim
    Oct 16, 2010
  4. pavi
    Replies:
    0
    Views:
    1,322
  5. friday13
    Replies:
    3
    Views:
    168
    friday13
    Apr 28, 2007
Loading...

Share This Page