Jump to content

[Solved] Setting an object's height to screen.height doesn't work?


Muller

Recommended Posts

Ok, quite a weird problem I have here.

I inserted the following code into footer.tpl:


   {literal}

   [removed]

   window.ready = changeHeight();

   function changeHeight() {
       // document.getElementById("center_column").style.height = "100px";
       var height = screen.height;
       alert("Height is: " + height);
       document.getElementById("center_column").style.height = screen.height;
   }

   [removed]

   {/literal}



What happens if that I get an alert saying "Height is 1200" which is correct for my screen, but the center column's height does not change. On the other hand, if I uncomment the line that statically sets the height to 100 pixels, and comment the following lines, it does work and change the height to 100 pixels.

Any ideas guys? How come setting an element's height to screen.height doesn't work?

I tried this idea in a simple test page and it did work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...