ContentVisibilityAutoStateChangeEvent: skipped-Eigenschaft
Baseline
2024
Newly available
Since September 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Die schreibgeschützte skipped-Eigenschaft des ContentVisibilityAutoStateChangeEvent-Interfaces gibt true zurück, wenn der User-Agent die Inhalte des Elements überspringt, andernfalls false.
Wert
Ein boolean. Gibt true zurück, wenn der User-Agent die Inhalte des Elements überspringt, andernfalls false.
Beispiele
js
const canvasElem = document.querySelector("canvas");
canvasElem.addEventListener("contentvisibilityautostatechange", stateChanged);
canvasElem.style.contentVisibility = "auto";
function stateChanged(event) {
if (event.skipped) {
stopCanvasUpdates(canvasElem);
} else {
startCanvasUpdates(canvasElem);
}
}
// Call this when the canvas updates need to start.
function startCanvasUpdates(canvas) {
// …
}
// Call this when the canvas updates need to stop.
function stopCanvasUpdates(canvas) {
// …
}
Spezifikationen
| Specification |
|---|
| CSS Containment Module Level 2> # dom-contentvisibilityautostatechangeevent-skipped> |
Browser-Kompatibilität
Siehe auch
- Das
contentvisibilityautostatechange-Event - CSS Containment
- Die
content-visibility-Eigenschaft - Die
contain-Eigenschaft