zoukankan      html  css  js  c++  java
  • javascript、jquery获取网页的高度和宽度

    可视区域宽 :document.documentElement.clientWidth  (width + padding)

    可视区域高 :document.documentElement.clientHeight (height + padding)

    可视区域宽: document.body.offsetWidth (包括边线的宽: width + padding + border)

    可视区域高: document.body.offsetHeight (包括边线的高:height + padding + border)

    内容高 : document.body.scrollHeight

    文档高 : document.body.offsetHeight

    纵向滚动的距离 : document.body.scrollTop || document.documentElement.scrollTop

    横向滚动的距离 : document.body.scrollLeft || document.documentElement.scrollLeft

    jquery:

    可视区域宽  : $(window).width()  

    可视区域高 :$(window).height()

    页面的文档宽 :$(document).width();

    页面的文档高 :$(document).height();

    获取滚动条到左边的垂直宽度 :$(document).scrollLeft();

    获取滚动条到顶部的垂直高度 :$(document).scrollTop();

  • 相关阅读:
    2017.4.6下午
    2017.4.6上午
    2017.3.31下午
    2017.4.5下午
    2017.4.5上午
    2017.4.1上午
    2017.3.31上午
    2017.3.28下午
    2017.3.28上午
    3.28上午
  • 原文地址:https://www.cnblogs.com/jeffrey77/p/3475675.html
Copyright © 2011-2022 走看看