Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Senior Member solidgold's Avatar
    Join Date
    Jun 2006
    Posts
    766
    Member #
    13373
    hi, is there some way to use document.getElementById('body') to hide a page overflow following a link being clicked? this would really help me.

    thanks a lot,
    Solidgold

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    What do you mean, exactly, a page overflow? Note that you wouldn't be able to use document.getElementById unless you explicitly gave the body that id. Instead you would do [minicode]document.getElementsByTagName('body')[0][/minicode].

  4. #3
    Senior Member solidgold's Avatar
    Join Date
    Jun 2006
    Posts
    766
    Member #
    13373
    page scroll, as in the css tag overflow:hidden

    Also, i wasn't sure about using document.getElementById('body'), now you mention it - it seems ridiculous to try using that!

    how do you think i could achieve this? i can't seem to find it anywhere on google.

  5. #4
    Senior Member hyperair's Avatar
    Join Date
    May 2005
    Posts
    452
    Member #
    9892
    I think you meant document.body. xD There isn't such a thing as document.getElementById('body') unless you have a <div id="body"> or some other element with the id body inside.
    Hyperair

  6. #5
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    So what you want to do is have page overflow but then, when a link gets clicked, disable that until the link gets followed? That is to say, you want to have scrollbars and then, when a link is clicked, turn them off until the link goes through?

  7. #6
    Senior Member solidgold's Avatar
    Join Date
    Jun 2006
    Posts
    766
    Member #
    13373
    no, i just want for scrollbars to be disabled once the link has been clicked

  8. #7
    Senior Member hyperair's Avatar
    Join Date
    May 2005
    Posts
    452
    Member #
    9892
    Code:
    <a href="lala.html" onclick="document.body.style.overflow='hidden'">click here!</a>
    Hyperair

  9. #8
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Yeah, as far as I know, you can just set overflow: hidden directly on the body. Ideally, you'd just set a class on the body and have that class specified externally to disable scrollbars. Trouble is, I'm not sure if setting overflow: hidden on the body works in IE 6. I have some inkling that it won't, but I don't remember for sure.

    So, in a perfect world, assuming jQuery and an external file:
    Code:
    $(document).ready(function() {
        $('#scrollbar-link').click(function() {
           document.body.className = 'unscrollable';
        });
    });
    And in a CSS file:
    Code:
    body.unscrollable
    {
        overflow: hidden;
    }
    Though `unscrollable' is a bad class name, since it describes what the CSS does, not a non-stylistic characteristic of the body.


Remove Ads

Posting Permissions

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

Search tags for this page

document getelementsbyname body
,

getelement body

,
getelementbybody
,

getelementbyid body

,
getelemetbyid body
,
javascript body tag getelement
Click on a term to search for related topics.
All times are GMT -6. The time now is 05:09 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com