Reputation: 4669
I want to retrieve using jQuery the total height of my HTML document. I tried so many things, the max height I could get is the total height of the viewport, never taking into account if there was a vertical scrollbar or not. The following screen indicates what I want:
$(document).height(); // return 898, which is only the height of the current visible part of the page
$(window).height(); // return 881
$("html").height(); // return 898
$("body").height(); // same
$("div#main").height(); // same
$(document).outerHeight(); // i'm wondering how can i do this ...
The tests was made on Firefox and Chrome browsers.
Can someone explain if it's even possible to do this?
Apparently, even if my problem is not solved, it's bound to a weird behaviour of SharePoint. I'm trying to get the document height on a SharePoint 2013 page, but it will always return the viewport height.
Upvotes: 3
Views: 1431
Reputation: 36
You can use outerHeight() with you content wrapper you need to call this inside document ready
example:-
// this return your all content height.
$(document).ready(function(){
$("your all content wrapper name").outerHeight();
});
Upvotes: 1
Reputation: 1
I am struggling with this as well, but you might want to try getting the height of one of the div wrappers, for example:
$("#DeltaPlaceHolderMain").height();
Upvotes: 0