4

我尝试绑定 FullScreenChange 事件,但它不起作用。也许我做错了什么?

$(document).bind('webkitfullscreenchange mozfullscreenchange fullscreenchange',function(){
if(document.fullScreen){
    console.log('Go to Full Screen mode');
    }else{
    console.log('Exit Full Screen mode');
    }
});
4

2 回答 2

14

您可能需要为document.fullScreen属性使用供应商特定的前缀

var isFullScreen = document.fullScreen || 
                   document.mozFullScreen || 
                   document.webkitIsFullScreen;

此处提供更多信息:

https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode

于 2013-01-27T16:48:03.453 回答
1

这对我有用:

window.onresize = resize
function resize() {
  //code
}
于 2020-03-21T00:17:41.780 回答