ContentVisibilityAutoStateChangeEvent: skipped 属性
ContentVisibilityAutoStateChangeEvent
接口的 skipped
只读属性在用户代理 跳过元素内容 时返回 true
,否则返回 false
。
值
布尔值。如果用户代理跳过元素的内容,则返回 true
,否则返回 false
。
示例
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) {
// …
}
规范
规范 |
---|
CSS Containment 模块级别 2 # dom-contentvisibilityautostatechangeevent-skipped |
浏览器兼容性
BCD 表格仅在浏览器中加载