✨✨ 返回元素节点的位置信息,判断是否在视口范围内
- 曝光埋点的时候判断是否可以曝光
- 获取元素的位置信息,返回的信息更全 ...
$ npm i --save @monajs/position
import position from '@monajs/position'
const ele = document.querySelector('#appWrapper')
// console.log(position._position(ele))
console.log(position(ele))
{
bottom: -133,
bottomToTop: 800,
el: HTMLElement,
height: 100,
isCompletelyInViewport: false,
isInViewport: false,
left: 100,
leftToRight: -275,
right: 175,
rightToLeft: 200,
screenHeight: 667,
screenWidth: 375,
top: 700,
topToBottom: 33,
width: 100,
}
微信:yx12032331