当前位置:网站首页>Better performance and simpler lazy loading of intersectionobserverentry (observer)
Better performance and simpler lazy loading of intersectionobserverentry (observer)
2022-07-29 07:33:00 【Moon and stars】
( The following are personal understandings used in the project , If you have any mistakes, please correct them )
IntersectionObserverEntry It is used to observe the interaction degree of two nodes
One 、 Get the observed node
Triggered when the observed node enters the visual interface
var target = document.getElementById('xxx')
Two 、 Create observers
var loadingObserver = new IntersectionObserver(ObserverList=>{
// ObserverList Is an array of observed nodes , Of each of these elements isIntersecting Represents entry or exit
if(ObserverList[0].isIntersecting){
console.log(' Being loaded ...')
}
},{
// The degree to which the two goals overlap
threshold: 0.1,
// root by null Or when not writing, it defaults to the browser visual interface
root: null
})
3、 ... and 、 Add the observed target
// target Will be inserted above ObserverList in
loadingObserver.observe(target)
// Multiple can be added
loadingObserver.observe(target1)
loadingObserver.observe(target2)
边栏推荐
- How can electronic component trading enterprises solve warehouse management problems with ERP system?
- Meta configuration item of route
- @Detailed explanation of requestmapping usage
- 09 bloom filter
- 【暑期每日一题】洛谷 P6336 [COCI2007-2008#2] BIJELE
- 【无标题】格式保存
- 08 dynamic programming
- JS day 4 process control (if statement and switch statement)
- Scala higher order (10): exception handling in Scala
- QT专题:基础部件(按钮类,布局类,输出类,输入类,容器类)
猜你喜欢
随机推荐
Reflect reflect
美智光电IPO被终止:年营收9.26亿 何享健为实控人
Scala higher order (IX): pattern matching in Scala
【暑期每日一题】洛谷 P7760 [COCI2016-2017#5] Tuna
QT基础第二天(2)qt基础部件:按钮类,布局类,输出类,输入类,容器等个别举例
国内数字藏品的乱象与未来
JS break and continue and return keywords
PAT甲级 1154 顶点着色
强连通分量
多线程购物
写点dp
【MYSQL】-【子查询】
logback appender简介说明
How does MySQL convert rows to columns?
Meizhi optoelectronics' IPO was terminated: annual revenue of 926million he Xiangjian was the actual controller
Dilworth 定理
Life cycle hooks in routing - activated and deactivated
How much data can a single MySQL table store at most?
[summer daily question] Luogu p6461 [coci2006-2007 5] trik
I'd like to ask, my flick job writes data in the way of upsert Kafka, but I'm more careful in MySQL








