//监听浏览器tab切换,以便在tab切换之后,页面隐藏的时候,把弹幕停止
document.addEventListener('webkitvisibilitychange', function() {
if (document.hidden === true) {
//页面已隐藏
} else {
//页面显示
}
}, false);
可参考:
https://developer.mozilla.org/zh-CN/docs/Web/Guide/User_experience/Using_the_Page_Visibility_API
http://www.iteye.com/news/26489
http://www.zhangxinxu.com/wordpress/2012/11/page-visibility-api-introduction-extend/
http://www.cnblogs.com/lhb25/archive/2012/11/15/more-html5-apis.html