zoukankan      html  css  js  c++  java
  • js获取网页的各种高度

    网页可见区域宽: document.body.clientWidth
    网页可见区域高: document.body.clientHeight
    网页可见区域宽: document.body.offsetWidth (包括边线的宽)
    网页可见区域高: document.body.offsetHeight (包括边线的高)
    网页正文全文宽: document.body.scrollWidth
    网页正文全文高: document.body.scrollHeight
    网页被卷去的高: document.body.scrollTop
    网页被卷去的左: document.body.scrollLeft
    网页正文部分上: window.screenTop
    网页正文部分左: window.screenLeft
    屏幕分辨率的高: window.screen.height
    屏幕分辨率的宽: window.screen.width
    屏幕可用工作区高度: window.screen.availHeight
    屏幕可用工作区宽度: window.screen.availWidth

    因为一直记不住这些所以转过来常看看就应该能记住了

    以上属于转载,出处http://www.cnblogs.com/wuchao/ 应该是这个出处吧

    有了这个我就可以来动态加载图片代码了

    1 document.onmousewheel = function () {
    2     var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    3     var hght = document.body.scrollHeight;
    4 if (scrollTop + document.documentElement.clientHeight >= hght) { 5 /*在这里写加载图片的代码*/ 6 }

     ps:以下方便自己记忆写在此处

     1.clientWidth和clientHeight是指的元素的内尺寸,元素内容+内边距 

     2.offsetWidth和offsetHeight是指元素的外尺寸,元素内容+内边距+边框

     3.clientLeft和clientTop是分别是指元素的border-left与border-top的值

     4.offsetLeft和offsetTop指的是该元素左上角变框的外边缘与父容器内边距的值 不包含border边框值

     5. offsetParent对象是指元素最近的定位(relative,absolute)祖先元素,如果没有祖先元素是定位的话,会返回null

  • 相关阅读:
    python和matlab
    进程和线程的主要区别
    如何理解卷积
    Leetcode 961. N-Repeated Element in Size 2N Array
    Leetcode 387. First Unique Character in a String
    Python ord()与chr()函数
    Leetcode 709. To Lower Case
    python 字符串大小写相关函数
    Leetcode 367. Valid Perfect Square
    Leetcode 1014. Capacity To Ship Packages Within D Days
  • 原文地址:https://www.cnblogs.com/miniyk/p/3728780.html
Copyright © 2011-2022 走看看