You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[简体中文](https://github.com/BiYuqi/vue-intersection-observer/blob/master/README.zh-CN.md) | English
5
4
6
-
比如:
7
-
* 当页面滚动时,实现懒加载图片功能。
8
-
* 实现`可无限滚动`网站,也就是当用户滚动网页时直接加载更多内容,无需翻页。
9
-
* 为计算广告收益,检测其广告元素的曝光情况。
10
-
* 根据用户是否已滚动到相应区域来灵活开始执行任务或动画
5
+
## Preface
6
+
The **Vue Intersection Observer** is a Vue component based on the [IntersectionObserver API](https://developer.mozilla.org/zh-CN/docs/Web/API/Intersection_Observer_API) integration, the packaging facilitates the implementation of information that needs to be used for element intersection changes.
11
7
12
-
## 如何使用 ( How to use? )
8
+
For example.
9
+
* Implementation of the lazy loading of images when the page is scrolled.
10
+
* Implementation of 'infinitely scrollable' websites, i.e. more content is loaded directly when the user scrolls the page, without turning the page.
11
+
* Detection of the exposure of its advertising elements for the purpose of calculating advertising revenue.
12
+
* Flexibility to start tasks or animations depending on whether the user has scrolled to the appropriate area or not.
The purpose of this component is to provide the simplest solution for observing the elements that enter the viewport on the Vue codebase. It is completely declarative, all complexity is abstracted away, and the focus is on reusability and low memory consumption.
root | HTMLElement | false | default browser viewport is used as root if root is specified as null or unspecified.
148
+
rootMargin | String | '0px' | false | defines the margin of the root element, which is used to expand or reduce the size of the rootBounds rectangle and thus affects the size of the intersection area of the intersectionRect. It uses CSS definitions such as 10px 20px 30px 40px to represent the values of top, right, bottom and left.
149
+
threshold | Number or Array\<number> | 0 | false | The threshold property determines when the callback function is triggered. It is an array where each member is a threshold value, which defaults to [0], i.e. when the intersectionRatio reaches 0, the callback function is triggered.
150
+
on-change | Function | required | (entry, unobserve) => {}
// intersectionRatio: the visible ratio of the target element, i.e. the ratio of the intersectionRect to the bindingClientRect, 1 if fully visible, less than or equal to 0 if not visible at all
0 commit comments