If you need to get the width and height of the window, you can use the following JavaScript code:
var width = window.innerWidth;
var height = window.innerHeight;
UPDATE:
In order to set the width of two div elements when the screen size is 568px or smaller, you can achieve that with the following JavaScript solution:
if(width <= 568) {
document.getElementById('div_1').style.width = '38%';
document.getElementById('div_2').style.width = '62%';
}
Alternatively, for a CSS-only approach using media queries which is recommended in this case, you can do the following:
.container{
width: 100%;
}
.div_element {
height: 100px;
width: 100%;
}
#div_1 {
width: 38%;
background: #adadad;
}
#div_2 {
width: 62%;
background: #F00;
}
@media(max-width: 568px) {
#div_1 {
width: 38%;
}
#div_2 {
width: 62%;
}
.div_element {
float: left;
}
}
<div class='container'>
<div id='div_1' class='div_element'>
div 1
</div>
<div id='div_2' class='div_element'>
div 2
</div>
</div>