草案
此页面不完整。
IntersectionObserver
interface's read-only
thresholds
property returns the list of intersection thresholds that was specified when the observer was instantiated with
IntersectionObserver()
. If only one threshold ratio was provided when instanitating the object, this will be an array containing that single value.
见 阈值 in 交集观测器 API to learn how thresholds work.
var thresholds = IntersectionObserver.thresholds;
An array of intersection thresholds, originally specified using the
threshold
property when instantiating the observer. If only one observer was specified, without being in an array, this value is a one-entry array containing that threshold. Regardless of the order your original
threshold
array was in, this one is always sorted in numerically increasing order.
若无
threshold
option was included when
IntersectionObserver()
was used to instantiate the observer, the value of
thresholds
is simply
[0]
.
Be careful! Although the
选项
object you can specify when creating an
IntersectionObserver
has a field named
threshold
, this property is called
thresholds
. Confusing? Yes. If you accidentally use
thresholds
as the name of the field in your
选项
,
thresholds
array will wind up being simply
[0.0]
, which is likely not what you expect. Debugging chaos may ensue.
<<<...>>>
| 规范 | 状态 | 注释 |
|---|---|---|
|
Intersection Observer
The definition of 'IntersectionObserver.thresholds' in that specification. |
工作草案 | 初始定义 |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
更新 GitHub 上的兼容性数据| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
thresholds
|
Chrome 51 | Edge 15 |
Firefox
55
|
IE No | Opera Yes | Safari 12.1 | WebView Android 51 | Chrome Android 51 | Firefox Android ? | Opera Android ? | Safari iOS 12.2 | Samsung Internet Android 5.0 |
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
用户必须明确启用此特征。
IntersectionObserver
root
rootMargin
thresholds