How to get height of entire document with JavaScript?

前端 未结 13 1788
逝去的感伤
逝去的感伤 2020-11-22 06:01

Some documents I can\'t get the height of the document (to position something absolutely at the very bottom). Additionally, a padding-bottom on seems to do nothing on these

13条回答
  •  悲&欢浪女
    2020-11-22 06:32

    To get the width in a cross browser/device way use:

    function getActualWidth() {
        var actualWidth = window.innerWidth ||
                          document.documentElement.clientWidth ||
                          document.body.clientWidth ||
                          document.body.offsetWidth;
    
        return actualWidth;
    }
    

提交回复
热议问题