var hiddenProperty =
"hidden" in document
? "hidden"
: "webkitHidden" in document
? "webkitHidden"
: "mozHidden" in document
? "mozHidden"
: null;
var visibilityChangeEvent = hiddenProperty.replace(
/hidden/i,
"visibilitychange"
);
var onVisibilityChange = function() {
if (!document[hiddenProperty]) {
document.title = "被发现啦(*´∇`*)";
} else {
document.title = "藏好啦(つд⊂) ";
}
};
document.addEventListener(visibilityChangeEvent, onVisibilityChange);
网友评论