网页宽高度中的常用参数:
一、页面实际的宽度和高度
网页的高度 document.documentElement.offsetHeight;网页的宽度 document.documentElement.offsetwidth;
二、眼睛能看见的高度和宽度
视口高度 window.innerHeight;视口宽度 window.innerWidth;
三、页面相对于左上角的横纵坐标(眼睛看到的部分)
网页元素距离左上角的视口横坐标 Element.getBoundingClientRect().left;网页元素距离左上角的视口纵坐标 Element.getBoundingClientRect().top;
四、页面相对于左上角的横纵坐标(实际页面的大小)
网页元素左上角的网页横坐标 Element.getBoundingClientRect().left + document.body.scrollLeft;网页元素左上角的网页纵坐标 Element.getBoundingClientRect().top + document.body.scrollTop;
五、页面滚动条移动的距离
网页滚动的水平距离 document.body.scrollLeft;网页滚动的垂直距离 document.body.scrollTop;
六、页面元素的实际高度
网页元素的高度 Element.offsetHeight;网页元素的宽度 Element.offsetWidth;