FrontendDeveloper.in

JavaScript question detail

What are the properties used to get size of window

You can use innerWidth, innerHeight, clientWidth, clientHeight properties of windows, document element and document body objects to find the size of a window. Let's use a combination of these properties to calculate the size of a window or document,

var width =
window.innerWidth ||
document.documentElement.clientWidth ||
document.body.clientWidth;

var height =
window.innerHeight ||
document.documentElement.clientHeight ||
document.body.clientHeight;
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399