This is frustrating me. It should be something really simple but I can't get it to work in IE. I want to get the height of the current window: Not the scroll height, not the document height, but the actual window height. I've tried window.innerHeight
which returns undefined
and document.documentElement.clientHeight
which gives the scroll height.
You can get the window height quite easily in pure CSS, using the units "vh", each corresponding to 1% of the window height. On the example below, let's begin to centralize block. foo by adding a margin-top half the size of the screen. But that only works for 'window' size.
Use window. innerWidth and window. innerHeight to get the current screen size of a page.
Windows are usually about three feet from the floor and approximately 18 inches from the ceiling. This leaves a header above the window, necessary for proper installation. This also leaves space beneath the window so that furniture will not obstruct or interfere much with the view.
For current browsers
window.innerHeight
For IE 8 and lower, use
document.documentElement.offsetHeight;
If you need older browsers, use:
var height = "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With