Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Scrollbar Problem

    I'm using this tag to make a div's scrollbar move to the top:

    <div id="scroll"> <p id="top">blah blah blah</p> <!-- more content --> <a href="#top">Top</a></div>

    When you click on the 'Top' link it does send the div's scrollbar back to the top. However, it also sends the main window's scrollbar to the bottom.Does anyone know how I can stop this happening?

  • #2
    Regular Coder
    Join Date
    Feb 2007
    Location
    Canada
    Posts
    924
    Thanks
    10
    Thanked 56 Times in 55 Posts
    Try moving the id to a named anchor outside of the p-tag
    Code:
    <div id="scroll"> 
    <a id="top"></a>
    <p >blah blah blah</p> 
         <!-- more content --> 
         <a href="#top">Top</a>
    </div>
    Or maybe target the div id instead of "top":
    Code:
    <div id="scroll"> 
    
    <p >blah blah blah</p> 
         <!-- more content --> 
         <a href="#scroll">Top</a>
    </div>
    Any chance you could post a link to a sample page?
    Last edited by jlhaslip; 03-12-2007 at 09:56 PM. Reason: add alternate answer

  • #3
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    link


  • #4
    Regular Coder
    Join Date
    Feb 2007
    Location
    Canada
    Posts
    924
    Thanks
    10
    Thanked 56 Times in 55 Posts
    Nope, the suggestions above don't work.
    Any chance you could solve some of the warnings the validator issues? Never know if that might be causing the problem.
    For instance, there are 4 warnings about invalid id's and names. Not the ones you are referencing, but ???
    Last edited by jlhaslip; 03-12-2007 at 10:42 PM.

  • #5
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    hm… it's actually sort of browser behavior. How about changing the link to "#" rather than "#top"? That'll effectively reload the same window (thus resetting all the scrollbars back to the top of the page).

  • #6
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    #

    That didn't work either. The main window's scrollbar went back to the top but the div's scrollbar didn't move. Any other thoughts?

  • #7
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That didn't work either. The main window's scrollbar went back to the top but the div's scrollbar didn't move. Any other thoughts?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •