当前位置:网站首页>js实现看板全屏功能

js实现看板全屏功能

2022-08-09 08:45:00 鱼是一只鱼啊

界面示意图
在这里插入图片描述

界面关键部分

<img class="fullImg" src="/Images/full.png" onclick="fullScreen()" />

js关键部分

function fullScreen() {
    
    var dd = document.documentElement
    var isFull = isFullScreen();
    if (!isFull) {
    
        if (dd.requestFullscreen) {
    
            dd.requestFullscreen();
        } else if (dd.mozRequestFullScreen) {
    
            dd.mozRequestFullScreen();
        } else if (dd.webkitRequestFullScreen) {
    
            dd.webkitRequestFullScreen();
        }
    } else {
    
        var de = document;
        if (de.exitFullscreen) {
    
            de.exitFullscreen();
        } else if (de.mozCancelFullScreen) {
    
            de.mozCancelFullScreen();
        } else if (de.webkitCancelFullScreen) {
    
            de.webkitCancelFullScreen();
        }
    }
}
function isFullScreen() {
    
    return !!(
        document.fullscreen ||
        document.mozFullScreen ||
        document.webkitIsFullScreen ||
        document.webkitFullScreen ||
        document.msFullScreen
    );
}
原网站

版权声明
本文为[鱼是一只鱼啊]所创,转载请带上原文链接,感谢
https://blog.csdn.net/honeycandys/article/details/121743755