浏览器全屏模式

//点击按钮进入全屏
function fullScreen(){
   var el = document.documentElement;
   var rfs = el.requestFullScreen || el.webkitRequestFullScreen || 
 el.mozRequestFullScreen || el.msRequestFullscreen;     //兼容IE,谷歌,火狐,360 
   if(typeof rfs != "undefined" && rfs) {
      rfs.call(el);
   };
   return;
}
//退出全屏
function exitScreen(){
    if (document.exitFullscreen) {  
        document.exitFullscreen();  
    }  
    else if (document.mozCancelFullScreen) {  
        document.mozCancelFullScreen();  
    }  
    else if (document.webkitCancelFullScreen) {  
        document.webkitCancelFullScreen();  
    }  
    else if (document.msExitFullscreen) {  
        document.msExitFullscreen();  
    } 
    if(typeof cfs != "undefined" && cfs) {
        cfs.call(el);
    }
}

 

你可能感兴趣的:(浏览器学习,前端学习,浏览器全屏,浏览器全屏模仿F11功能)