-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[zh-cn] update intersection observer api #17222
Conversation
@@ -1,43 +1,45 @@ | |||
--- | |||
title: Intersection Observer API | |||
title: 交叉观察器 API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preview URLs Flaws (12)URL:
External URLs (2)URL:
(comment last updated: 2023-12-08 03:08:11) |
6. This rectangle is, finally, mapped to the coordinate space of the target's {{domxref("document")}}. | ||
1. 在目标元素上调用 {{domxref("Element.getBoundingClientRect", "getBoundingClientRect()")}} 以获得目标元素的边界矩形(即完全包围组成该元素的每个组件的边界框的最小矩形)。这是最大的交集矩形。其余步骤将删除不相交的部分。 | ||
2. 从目标块的直接父块开始向外移动,将每个包含块的剪切(如果有)应用到交叉矩形。一个块的剪切是根据两个块的交点和 {{cssxref("overflow")}} 属性指定的剪切模式(如果有)确定的。将 `overflow` 设置为 `visible` 以外的任何值都会导致剪切发生。 | ||
3. 如果其中一个包含元素是嵌套浏览上下文(如 {{HTMLElement("iframe")}} 中包含的文档)的根元素,则交集矩形会剪切到包含上下文的视口,并通过容器的包含块继续向上递归。因此,如果到达 `<iframe>` 的顶层,交集矩形会剪切到框架的视口,然后框架的父元素会成为向交集根递归的下一个块。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
裁剪
|
||
We could opt to monitor multiple elements for visibility intersection changes with respect to the viewport by calling `observer.observe()` for each of those elements, if we wanted to do so. | ||
我们可以选择监控多个元素相对于视口的可见性交叉变化,如果我们想这样做的话,可以为每个元素调用 `observer.observe()`。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Co-authored-by: A1lo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jasonren0403
Description
Motivation
Additional details
Related issues and pull requests