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);
}
}
// 在画布需要开始更新时调用此方法。
function startCanvasUpdates(canvas) {
// …
}
// 在画布需要停止更新时调用此方法。
function stopCanvasUpdates(canvas) {
// …
}
规范
Specification |
---|
CSS Containment Module Level 2 # dom-contentvisibilityautostatechangeevent-skipped |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
skipped |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No 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.