get document height with angularjs 1.2.4 (not the body)

大兔子大兔子 提交于 2019-12-10 21:39:57

问题


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:


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
    );
}


来源:https://stackoverflow.com/questions/20500056/get-document-height-with-angularjs-1-2-4-not-the-body

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!