I got this script for detecting the size of the window -
function myFunction()
{
var w = window.innerWidth;
var h = window.innerHeight;
if (w = 768) {
document.getElementById("container").style.height = "15.155em";
} else if (w = 1024) {
document.getElementById("container").style.height = "25.155em";
} else if (w = 1366) {
document.getElementById("container").style.height = "35.155em";
}
}
<body onload="myFunction()">
<div id="container" style="width:50px;border:2px solid black;">
</div>
</body>
What i would like to happen,is each time the height of the div would change,according to the size of window.
Whats happening now,is on every screen i run the website its showing me as if the screen size is the "768"
height:100%;orheight:100vh;.