当前位置:网站首页>JS to achieve full screen effect
JS to achieve full screen effect
2022-07-29 09:38:00 【Sabo】
http://mpvideo.qpic.cn/0b78biabsaaadaacplu7bvqfacwddefaagia.f10002.mp4?
Click the button to trigger requestFullscreen() Function open full screen
requestFullscreen () {
const docElm = document.documentElement
if (docElm.requestFullscreen) {
docElm.requestFullscreen()
} else if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen()
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen()
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen()
}
}
Click the button to trigger exitFullScreen() Function to close the full screen
exitFullScreen () {
if (document.exitFullscreen) {
document.exitFullscreen()
} else if (document.msExitFullscreen) {
document.msExitFullscreen()
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen()
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen()
}
}
If you need to monitor the full screen state transition , Can monitor fullscreenchange event
document.addEventListener('fullscreenchange', () => {
console.log('fullscreenchange')
})
Vue Project implementation address
https://github.com/gywgithub/vue-d3-examples
https://github.com/gywgithub/vue-d3-examples/blob/master/src/views/Examples.vue#L263
Reference link
https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API
https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API/Guide
边栏推荐
猜你喜欢

怎么样的框架对于开发者是友好的?

NFA determination and DFA minimization based on C language

On contract testing
![[苹果开发者账号]06 转让开发者账号后,开发者年费自动续费问题](/img/a7/12fd63f16ebca81a3dd2d1b97847d1.png)
[苹果开发者账号]06 转让开发者账号后,开发者年费自动续费问题

WebAssembly 2022 问卷调查结果新鲜出炉

PyQt5快速开发与实战 6.4 QBoxLayout(框布局)

【C语言】三子棋(智能下棋 + 阻拦玩家)

查看端口占用情况

HarmonyOS 3.0 发布!

Use cpolar to publish raspberry pie web pages (improvement of cpolar function)
随机推荐
How to contribute to openharmony
查看端口占用情况
pytest+allure生成测试报告
Configuration file settings for remote connection to Windows version server redis
Summary of pit trampling records and solutions of data warehouse project
View port occupancy
40余岁的边缘老技术,是未来乏力还是掘地而起?
Asp graduation project - based on C # +asp Design and implementation of enterprise investment value analysis system based on. Net + sqlserver (graduation thesis + program source code) -- enterprise in
Parameter passing mode of C language (int x) (int *x) (int & x)
OpenCV图像处理基础操作
redis可视化工具读取数据乱码问题解决
AxureRP原型设计 快速开始
不用Swagger,那我用啥?
How to change MySQL into Chinese
【C语言】扫雷(递归展开 + 标记功能)
Zhongang Mining: four steps for sustainable and healthy development of fluorite industry
Unity guidance system. Click the target object and prompt the text to change color to enter the next step
NFA determination and DFA minimization based on C language
Study and exploration of Redux API implementation of Redux
Unity Xchart3.0基本用法快速上手