Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to dynamically change Javascript Height
    primarykey
    data
    text
    <p>I know that this question has been asked a lot and I assure you I have read a majority of the answers. However, in my case, none of it has worked for me. I am currently trying this:</p> <pre class="lang-js prettyprint-override"><code>window.onload = function(){ var winWidth = parseInt(window.innerWidth); var winHeight = parseInt(window.innerHeight); document.getElementById("copyRight").innerHTML = winHeight; //This is so I could make sure the height was actually changing. It is. document.getElementById("grandeContain").style.width = winWidth-15+"px"; document.getElementById("grandeContain").style.height = winheight+"px"; document.getElementById("contain").style.width = winWidth-105+"px"; document.getElementById("contain").style.height = winHeight-90+"px"; document.getElementById("outside").style.width = winWidth-105+"px"; document.getElementById("outside").style.height = winHeight-90+"px"; document.getElementById("aroundToolBar").style.height = winHeight-90+"px"; } </code></pre> <p>However, no matter what I do the height is not changing <code>onload</code> (I also have this copy and pasted into an <code>onresize</code> function and that doesn't work either). The width parts work fine (not just because that is the default setting for divs; I've tested with many different widths based on <code>window.innerWidth</code> and it changed) but the heights refuses to change. What am I doing wrong? I've always had trouble dynamically changing height and it would be great if I could figure this out once and for all. </p> <p>Also, if css has anything to do with it, the div tree is like this: <code>grandeContain&gt;contain&gt;(aroundToolBar+outside)</code> where <code>contain</code> is <code>position:relative</code>, <code>aroundToolbar</code> is <code>float:left</code> and <code>width:125px</code>, and <code>outside</code> is <code>position:relative</code> with <code>margin 0 0 0 125px</code>.</p> <p>Does anyone know what I am doing wrong here?</p> <p>Also, the 105s and 90s are there soley because of a header and footer in the <code>grandeContain</code> div, with their sibling contain.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload