700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > JS 实现全屏切换 移动端适用

JS 实现全屏切换 移动端适用

时间:2018-11-22 05:34:05

相关推荐

JS 实现全屏切换 移动端适用

JS 实现全屏切换,移动端适用

直接看代码吧,简单,只是有些人不知道这个 api,我之前就不知道…

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title></head><body><button onclick="test()">点我切换全屏</button></body><script>function test() {if (document.fullscreenElement) {document.exitFullscreen()} else {document.documentElement.requestFullscreen()}}</script></html>

文档链接:/zh-CN/docs/Web/API/Document/exitFullscreen

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。