美文网首页
js获取各种网页高度

js获取各种网页高度

作者: 清风不问烟雨丶 | 来源:发表于2018-09-07 16:19 被阅读0次

    1、获取屏幕的高度和宽度(屏幕分辨率):

        1、window.screen.height
        2、window.screen.width
    

    2,获取屏幕工作区域的高度和宽度(去掉状态栏):

        1、window.screen.availHeight
        2、window.screen.availWidth
    

    3、网页全文的高度和宽度:

        1、document.body.scrollHeight
        2、document.body.scrollWidth
    

    4、滚动条卷上去的高度和向右卷的宽度:

        1、document.body.scrollTop
        2、document.body.scrollLeft
    

    5、网页可见区域的高度和宽度(不加边线):

        1、document.body.clientHeight
        2、document.body.clientWidth
    

    6、网页可见区域的高度和宽度(加边线):

        1、document.body.offsetHeight
        2、document.body.offsetWidth
    

    相关文章

      网友评论

          本文标题:js获取各种网页高度

          本文链接:https://www.haomeiwen.com/subject/ljvcgftx.html