Reputation: 567
I need the empty area of a html page.
How can i calculate the red marked are using javascript? Sorry if my question is silly
Upvotes: 0
Views: 231
Reputation: 4505
You want the distance of the HTML document minus the height of the screen:
var html = document.documentElement;
var doc_height = Math.max(html.clientHeight, html.scrollHeight, html.offsetHeight);
var height = (screen.height > doc_height ? screen.height-doc_height : 0); //if the space exists, else return 0
Upvotes: 1
Reputation: 116
If you need to do it with javascript then you can use the above comment to find classes. If you just need the areas in general most browsers will have pixel ruler extensions that will help you with width and height measurements.
[
Upvotes: 0
Reputation: 579
Red mark area will have a particular class.You can use
CODE
document.getElementByClassname('.className').clientHeight;
Upvotes: 0