js 监听窗口是否被激活
document.addEventListener("visibilitychange", function() { console.log( document.hidden ); // Modify behavior... });
文档链接:
https://developer.mozilla.org/en-US/docs/Web/API/Document/hidden
document.addEventListener("visibilitychange", function() { console.log( document.hidden ); // Modify behavior... });
文档链接:
https://developer.mozilla.org/en-US/docs/Web/API/Document/hidden