3

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

1 Answer 1

4

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
    );
}
Sign up to request clarification or add additional context in comments.

3 Comments

Your code return the height of the body... Not the entire page. For example my window make 550px and my document 2220 (actually but it's variable) and your function return 550.
My apologize, the content is loaded after I get the Height. =) Thanks !
This actually applies to any frontend code, not Angular specified.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.