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

[html] 第389天 举例说明图片懒加载的方案有哪些? #2347

Open
haizhilin2013 opened this issue May 8, 2020 · 2 comments
Open
Labels
html html

Comments

@haizhilin2013
Copy link
Collaborator

第389天 举例说明图片懒加载的方案有哪些?

我也要出题

@haizhilin2013 haizhilin2013 added the html html label May 8, 2020
@mx623303468
Copy link

  1. 利用 getBoundingClientRect() 这个 API 获取图片元素相对于视口的位置,来判断是否需要加载图片

  2. 利用 IntersectionObserverEntry接口 获取目标元素与容器的相交状态

@lqq-code
Copy link

这里我是用的IntersectionObserver API去实现的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
html html
Projects
None yet
Development

No branches or pull requests

3 participants