harkor
harkor

Reputation: 503

get document height with angularjs 1.2.4 (not the body)

I'm trying since 2 hours to find the entire document with AngularJS.

I found a lot of question about the height of the body, but nothing for the entire document.

With jQuery, I use $(document).height and the game is played but with angularjs I can have $window.height but if I'm trying $document.height, the function return "undefined".

I use AngularJS 1.2.4

Upvotes: 3

Views: 5598

Answers (1)

Mathew Berg
Mathew Berg

Reputation: 28750

From http://james.padolsey.com/javascript/get-document-height-cross-browser/

function getDocHeight() {
    return Math.max(
        document.body.scrollHeight, document.documentElement.scrollHeight,
        document.body.offsetHeight, document.documentElement.offsetHeight,
        document.body.clientHeight, document.documentElement.clientHeight
    );
}

Upvotes: 4

Related Questions