NodesRef.scrollOffset
Function callback
示例
- 在 swan 文件中
- 在 js 文件中
appear: false
},
onReady() {
const IntersectionObserver = swan.createIntersectionObserver(this);
IntersectionObserver.relativeTo('.scroll-view').observe('.ball', res => {
this.setData('appear', res.intersectionRatio > 0);
});
this.IntersectionObserver = IntersectionObserver;
getNodeRef() {
const node = swan.createSelectorQuery().select('.scroll-view');
console.log('scrollOffset:::', res);
swan.showModal({
title: 'scrollOffset',
content: JSON.stringify(res)
});
}).exec();
});