scroll position is changed when style is changed?

Discussion in 'Javascript' started by mxbrunet, Nov 3, 2006.

  1. mxbrunet

    mxbrunet Guest

    When I scroll down my page and trigger js that changes a div's
    visibility to 'visible' and display to 'block' the page gets
    repositionned to the top (i.e. automatically scrolls to the top) and I
    have to scroll back down.

    How can I avoid this?
     
    mxbrunet, Nov 3, 2006
    #1
    1. Advertising

  2. mxbrunet

    ASM Guest

    mxbrunet a écrit :
    > When I scroll down my page and trigger js that changes a div's
    > visibility to 'visible' and display to 'block' the page gets
    > repositionned to the top (i.e. automatically scrolls to the top) and I
    > have to scroll back down.


    My test doesn't do what you say.

    If you call your function in a link don't forget return false;

    <a href="#"
    onclick="fToHideShow('div_1')";
    return false;">
    show/hide div 1
    </a>


    > How can I avoid this?


    Example ?
     
    ASM, Nov 3, 2006
    #2
    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. nicholas
    Replies:
    0
    Views:
    446
    nicholas
    Dec 7, 2004
  2. Kevin
    Replies:
    1
    Views:
    9,572
    Roland
    Feb 5, 2005
  3. Sathiamoorthy

    Enable Scroll up and scroll down in CR-report

    Sathiamoorthy, Nov 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    910
    zobalee
    Nov 28, 2006
  4. UJ
    Replies:
    1
    Views:
    602
    John Timney \(MVP\)
    Nov 1, 2006
  5. Amir Hardon
    Replies:
    0
    Views:
    269
    Amir Hardon
    May 31, 2004
Loading...

Share This Page