Document.onvisibilitychange
是一个事件处理方法,它将在该对象的 visibilitychange
事件被触发时调用。
Syntax
obj.onvisibilitychange = function;
function
是一个用户定义的方法的名字(而非带()和任何参数的函数调用),或者匿名函数的申明。
例子
document.onvisibilitychange = function() {
console.log("Visibility of page has changed!");
};
标准
Specification | Status | Comment |
---|---|---|
Page Visibility (Second Edition) onvisibilitychange |
Recommendation | Initial definition. |
浏览器兼容性
BCD tables only load in the browser
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.