BOM,Dom 回顾

加给元素:
offsetLeft(距离定位父级的距离)/offsetTop(距离定位父级的距离)/offsetWidth(可视宽度)/offHeight(可视高度)
clientLeft(左边框宽度)/clientTop(上边框宽度)/clientWidth(width+padding)/clientHeight(height+padding)
getBoundingClientRect() 返回值对象
left (元素左侧相对于可视区左上角的距离)
right(元素右侧相对于可视区左上角的距离)
top (元素上边相对于可视区左上角的距离)
bottom (元素底部相对于可视区左上角的距离)
width (可视宽度)
height (可视高度)
scollTop(纵向滚动距离)/scollLeft(横向滚动距离)/scollWidth(内容宽度)/scollHeight(内容高度)
 
获取可视区宽高:
window.innerWidth/window.innerHeight
document.documentElement.clientWidth/document.documentElement.clientHeight
 
屏幕宽度:window.screen.wid
获取文档宽高:
document.body.clientWidth/document.body.clientHeight
document.documentElement.scrollHeight/document.documentElement.scrollWidth
document.body.scrollHeight/dcth,window.screen.height
ument.body.scrollWidth
o
获取滚动条距离:
document.body.scrollTop/document.body.scrollLeft
window.scrollY/window.scrollX
document.documentElement.scrollTop/document.documentElement.scrollLeft
window.pageYOffset/window.pageXOffset
原文地址:https://www.cnblogs.com/YinWeiBlog/p/7513087.html