Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正lazyload有时候失效的问题 #1090

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants