当前视口高度:
document.documentElement.clientHeight // 页面高度
获取元素距离当前视口的距离:
let obj = bom.getBoundingClientRect()
obj .top // 元素上边到视口上边的距离
obj .right // 元素右边到视口左边的距离
obj .bottom // 元素下边到视口上边的距离
obj .left // 元素左边到视口左边的距离
当前视口高度:
document.documentElement.clientHeight // 页面高度
获取元素距离当前视口的距离:
let obj = bom.getBoundingClientRect()
obj .top // 元素上边到视口上边的距离
obj .right // 元素右边到视口左边的距离
obj .bottom // 元素下边到视口上边的距离
obj .left // 元素左边到视口左边的距离