Skip to content

Commit 4973a5d

Browse files
author
Simon he
committed
chore: add exitFullscreen
1 parent 8960548 commit 4973a5d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/exitFullscreen.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export function exitFullscreen() {
2+
const el: any = (parent as any).documentElement
3+
const cfs = el?.cancelFullScreen || el?.webkitCancelFullScreen || el?.mozCancelFullScreen || el?.exitFullScreen;
4+
if (cfs)
5+
cfs.call(el);
6+
else
7+
alert("切换失败,可尝试Esc退出")
8+
}

0 commit comments

Comments
 (0)