Source language: Translate to:

Set element height according the screen height

Questions and information about creating Internet aware NeoBook applications. Including PHP, HTML, FTP, HTTP, Email, etc.

Moderator: Neosoft Support

Set element height according the screen height

Postby David de Argentina » Fri Oct 13, 2017 1:13 pm

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
User avatar
David de Argentina
 
Posts: 1559
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Set element height according the screen height

Postby Neosoft Support » Sun Oct 29, 2017 11:23 am

Very interesting. Is this something you're doing with NeoBook?
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to NeoBook and the Internet

Who is online

Users browsing this forum: No registered users and 1 guest