calculate the height of the page js code example
Example 1: javascript get element width
var width = document.getElementById('myID').offsetWidth;
var height = document.getElementById('myID'). offsetHeight;
Example 2: how to get the height of window in javascript
window.innerHeight
window.innerWidth
Example 3: javascript get body height
var body = document.body,
html = document.documentElement;
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );