IntersectionObserverEntry: target プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2019.
IntersectionObserverEntry
インターフェイスの読み取り専用の target
プロパティは、交差ルートとの交差量が変化したのがどの対象要素であるかを Element
で示します。
値
IntersectionObserverEntry
の target
プロパティは、以前に IntersectionObserver.observe()
を呼び出して対象とした Element
の中で、ルートとの交差量が変化したものを示します。
例
この単純な例では、対象となるそれぞれの要素の opacity
が、その intersectionRatio
に設定されます。
js
function intersectionCallback(entries) {
entries.forEach((entry) => {
entry.target.style.opacity = entry.intersectionRatio;
});
}
より具体的な例については、交差状態の変化の扱いをご覧ください。
仕様書
Specification |
---|
Intersection Observer # dom-intersectionobserverentry-target |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
target |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on 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.