Currently, I'm setting width and height of some elements with jQuery in window resize event, based on window.innerWidth
and window.innerHeight
.
Something like this:
$(".gr1").css("height", (window.innerHeight - 150) + "px");
And these are some other examples:
$(".gr2").css("width", ((window.innerWidth / 2) - 12).toString() + "px");
$(".box1").css("height", ((window.innerHeight - 150) / 3 - 12).toString() + "px");
$(".box2").css("height", ((window.innerHeight - 150) / 2 - 12).toString() + "px");
And this is rendering a little slow in Chrome 21 (Windows) and renders too slow in iPad and Nexus 7 tablet. (Since there are many elements with gr1
, gr2
, box1
and box2
classes)
Can I do this in Pure CSS to give better performance? How?