Page 1 of 1

Set element height according the screen height

PostPosted: Fri Oct 13, 2017 1:13 pm
by David de Argentina
Hi overthere,

I'm working on a program that needs to set all objects height according the phone screen height.

Main screen has a table with this settings:

Code: Select all
<table width="100%"  border="0">

    <tr>
      <td> </td>
      <td height="300" id="largo" colspan="7" bgcolor="#CCCCFF">
        <iframe id="iframe" src="load.php" height="100%" width="100%"></iframe>
      </td>
      <td> </td>
    </tr>
...
...


Note this row has a iframe into it.
I need to resize it dinamically.

the easy way i found to do this is:

a) Set the <body> tag as:

Code: Select all
<body onload="getlarge();">


b) a javascript like this:

Code: Select all
<script>
function getlarge(){
document.getElementById("largo").height=(window.innerHeight-240);
}
</script>


window.innerHeight allows to get all useable screen height,

You can use this as factor (window.innerHeight * 0.65) or as you need

Enjoy it!
David de Argentina

Re: Set element height according the screen height

PostPosted: Sun Oct 29, 2017 11:23 am
by Neosoft Support
Very interesting. Is this something you're doing with NeoBook?