js全屏与退出全屏

function Fullscreen() {
    var elem = document.documentElement;
    // 判断浏览器设备类型
    if (elem.webkitRequestFullScreen) {  // 兼容谷歌
        elem.webkitRequestFullScreen();
    } else if (elem.mozRequestFullScreen) {  // 兼容火狐
        elem.mozRequestFullScreen();
    } else if (elem.requestFullscreen) {
        elem.requestFullscreen();
    } else if (element.msRequestFullscreen) {  // 兼容IE
        elem.msRequestFullscreen();
    } else {
        //浏览器不支持全屏API或已被禁用
    }
}


function ExitFullscreen() {
    if (document.exitFullscreen) {
        document.exitFullscreen();
    } else if (document.msExitFullscreen) {
        document.msExitFullscreen();
    } else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
    } else if (document.webkitExitFullscreen) {
        document.webkitExitFullscreen();
    }
}

 

上一篇:STL容器list容器API


下一篇:循环队列