SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast Red Blaze's Avatar
    Join Date
    Feb 2006
    Location
    Texas
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Full page height

    Hello,

    I'm trying to retreive the page's full height, but I can't figure it out. I tried this piece of code:

    Code:
    function setHeight() {
    	var x,y;
    	var test1 = document.body.scrollHeight;
    	var test2 = document.body.offsetHeight
    	if (test1 < test2) // all but Explorer Mac
    	{
    		x = document.body.scrollWidth;
    		y = document.body.scrollHeight;
    		document.getElementById("overlay").style.height = y;
    	}
    	else // Explorer Mac;
    	     //would also work in Explorer 6 Strict, Mozilla and Safari
    	{
    		x = document.body.offsetWidth;
    		y = document.body.offsetHeight;
    		document.getElementById("overlay").style.height = y;
    	}
    }
    the overlay is a div tag; it's suppose to set the height, but it doesn't work. >.<
    That div layer has CSS too, this is it:

    Code:
    #overlay{
    	position: absolute;
    	top: 0;
    	left: 0;
    	z-index: 1;
    	width: 100%;
    	background-color: #000;
    	filter:alpha(opacity=60);
    	-moz-opacity: 0.6;
    	opacity: 0.6;
    	visibility: hidden;
    }
    Help would be greatly appreciated.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)

    height

    minHeight ???

  3. #3
    SitePoint Enthusiast Red Blaze's Avatar
    Join Date
    Feb 2006
    Location
    Texas
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't understand your post.

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The pages height depends on what mode y ou are rendering the page in. What DOCTYPE are you using?

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)

    minHeight

    In addition to
    HTML Code:
    document.getElementById("overlay").style.height = y;
    try this too
    HTML Code:
    document.getElementById("overlay").style.minHeight = y;


Bookmarks

Posting Permissions

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