2015-09-19 69 views

回答

2

您應該使用visibilitychange事件。有關更多信息,請參閱MDN documentation

document.addEventListener("visibilitychange", function() { 
 
    console.log(document.visibilityState); 
 
    console.log(document.hidden); 
 
});

2

您應該使用visibilitychange事件:

document.addEventListener("visibilitychange", function() { 
    console.log(document.visibilityState); 
});