tags:

views:

42

answers:

1

Hi, I have a page which can rezise depending on the content. What I need is a way for the side bars to increase / decrease along with the body, but never to be less than 100% of the visible body. Initially the page looks fine, but when I increase the content, I can see white space underneath the left and right sides, there should not be any.

Any help appreciated.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

.container { background-color: Gray;
height: 100%;
width: 100%;
position: absolute;
clear: both;
} .content { background-color: white; width: 80%; margin: 0 auto; height: 100%; min-height: 100%;
}

<script language="javascript" type="text/javascript">
    function MakeBig() {
        var html = "";
        for (var i = 0; i < 500; i++) {
            html += "this is some random filler text<br/>";
        }
        $("#textHolder").html(html);
    }

    function MakeSmall() {
        var html = "";
        for (var i = 0; i < 5; i++) {
            html += "this is some random filler text<br/>";
        }
        $("#textHolder").html(html);

    }
</script>

This is some text in the content Increase Content
Decrease Content

A: 

Here is a jQuery way. But, not a bullet proof one. Hope you would get some idea...

<style type="text/css">
    html { height: 100% }
</style>

<script type="text/javascript">
    $(document).ready(function() {
     if(!($(window).height() < $(document).height())) {
      $("#wrapper").css("height", "100%");
      $("#sidebar").css("height", "100%");
     }
     $("#content").resize(function() {
      if($("#content").height() > $(window).height())
       $("#sidebar").height($("#content").height());
     });
    });
</script>

<div id="wrapper">
    <div id="sidebar"></div>
    <div id="content"></div>
</div>
Ei Maung
I have tried something like this in the past, but the issue I faced when when making the content smaller, i had no way to check if the pixel value was less than 100% of the window.b.t.wYour code above doesn't work, but was a good idea.
JD