FullScreenChange事件不起作用

时间:2013-01-27 16:39:45

标签: javascript jquery html5 fullscreen

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

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

2 个答案:

答案 0 :(得分:12)

您可能需要为document.fullScreen属性

使用供应商特定的前缀
var isFullScreen = document.fullScreen || 
                   document.mozFullScreen || 
                   document.webkitIsFullScreen;

此处提供更多信息:

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

答案 1 :(得分:0)

这对我有用:

{{1}}