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 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Rhondda, Wales, UK
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Browser scroll bar - detectable?

    Hello,

    Is there a way to detect if the browsers scroll bar is shown, my question is only directed to IE browsers. I know there's a reserved area on the right-hand side of approx 20px, but is there a way to detect if content runs off the page and the scroll bar is shown. Thanks very much for any help.

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't know if there is a way, but in css, you can use overflow

    //i think this is how it is
    html {overflow: hidden
    }

    //might be
    body {overflow:hidden
    }

    mabey that might help for you.

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    if ( document.body.scrollHeight > document.body.clientHeight )
    {
        // vertical scrollbars present
    }
    else
    {
        // no vertical scrollbars present
    }
    source: http://msdn.microsoft.com/library/de.../measuring.asp
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #4
    New Coder
    Join Date
    Jul 2002
    Location
    Rhondda, Wales, UK
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks chrismiceli for your suggestion but i was looking for a solution in javascript - nice one Beetle your solution works fine, thank you


  •  

    Posting Permissions

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