Vladi Ivanov
Vladi Ivanov

Reputation: 57

Real height of the page (all content), JS

This question isn't here and this is not duplicate.

I need real page (full) height, not only visible part, but scrolled part included. I try:

$('body/html').height(), window.height, window.outerHeight 

and others, but they give me only the visible height of the page. I want all height.

I work with:

html, body { height: 100%;}, 

With many contents and scroll in the page and page with long content. How can I get full height of the page ?

Upvotes: 1

Views: 77

Answers (2)

Vladi Ivanov
Vladi Ivanov

Reputation: 57

I am using: document.body.scrollHeight

Upvotes: 0

Josh Rutherford
Josh Rutherford

Reputation: 2723

With jQuery $('html').outerHeight() is what you want. The window height is only the height of the viewport. The only way the above wouldn't work is if your html is constrained to the height of the window and you have some other wrapping div with an overflow, in which case you'd want to get its outerHeight().

Upvotes: 1

Related Questions