# IntersectionObserver.disconnect

停止监听,回调函数将不再触发。

# 支持说明

应用能力 Android iOS PC 预览效果
小程序 3.0.0 3.0.0 3.2.0 待补充
网页应用 X X X 待补充

# 输入

# 输出

# 代码示例


onReady() {
    observer = bz.createIntersectionObserver(this);
    observer.relativeTo('.scroll-view').observe('.ball', (res) => {
        if (res.intersectionRatio > 0 && !this.appear) {
        this.appear = true;
        } else if (!res.intersectionRatio > 0 && this.appear) {
        this.appear = false;
        }
    })
},
onUnload() {
    if (observer) {
        observer.disconnect()
    }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
最后更新于 : 2/8/2023, 8:14:36 PM