posts - 108,  comments - 44,  views - 45万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

一、实现页面全屏

复制代码
 1     function doFullscreen (el) {
 2       if (el == null) {
 3         el = document.documentElement
 4       }
 5       const func = el.requestFullscreen || el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen
 6       if (!func) {
 7         throw new Error("您的浏览器不支持全屏模式");
 8       }
 9       func.call(el)
10     }
复制代码

二、退出全屏

1     function doExitFullscreen () {
2       const func = document.exitFullscreen || document.exitFullScreen || document.webkitCancelFullScreen || document.mozCancelFullScreen || document.msExitFullscreen
3       func && func.call(document);
4     }

三、检测是否为全屏

1     function doCheckFullscreen () {
2       return !!(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement)
3     }

 

posted on   小老虎网络  阅读(98)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2015-10-13 iphone中button按钮显示为圆形解决
点击右上角即可分享
微信分享提示