Skip to content

Conversation

@appotry
Copy link

@appotry appotry commented Apr 21, 2024

把element 看做 上下左右加长offsetFactor的箱子来定位
原来的代码看不太明白意义

@appotry
Copy link
Author

appotry commented Apr 21, 2024

已经切换到dev分支了,还是有个测试报错

@zkqiang
Copy link
Member

zkqiang commented Jun 18, 2024

原本代码中 offsetFactor 是为了提前 N 屏的高度触发 lazyload

你这个实现是达不到之前的效果的

@appotry
Copy link
Author

appotry commented Jun 20, 2024

下面代码实现了提前触发的,判断两个盒子是否有重叠,无论放大哪一个盒子都是可行的

const viewportHeight = (window.innerHeight || document.documentElement.clientHeight) * (1 + offsetFactor);
const viewportWidth = (window.innerWidth || document.documentElement.clientWidth) * (1 + offsetFactor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants