4

I try bind FullScreenChange event, but it not work. Maybe i did something wrong?

$(document).bind('webkitfullscreenchange mozfullscreenchange fullscreenchange',function(){
if(document.fullScreen){
    console.log('Go to Full Screen mode');
    }else{
    console.log('Exit Full Screen mode');
    }
});
Aleksov
  • 1,200
  • 5
  • 17
  • 27

2 Answers2

14

You probably need to use the vendor specific prefix for the document.fullScreen property

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

Further information available here:

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

lostsource
  • 21,070
  • 8
  • 66
  • 88
1

This worked for me:

window.onresize = resize
function resize() {
  //code
}
agiopnl
  • 1,190
  • 9
  • 18