-
Notifications
You must be signed in to change notification settings - Fork 5
/
screen.html
31 lines (29 loc) · 844 Bytes
/
screen.html
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
<!doctype html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<style>
html, body, iframe {
margin: 0px;
width: 100vw;
height: 100vh;
}
#fsButton {
position: fixed;
z-index: 10;
top: 20px; left:20px;
}
</style>
<button id="fsButton">Fullscreen</button>
<iframe id="frame" src="./index.html"></iframe>
<script>
const fsButton = document.getElementById('fsButton');
const iframe = document.getElementById('frame');
const requestFullscreen = iframe.requestFullscreen
|| iframe.webkitRequestFullscreen || iframe.msRequestFullscreen;
if (requestFullscreen === undefined) {
fsButton.style.display = 'none';
}
fsButton.onclick = ()=>{
requestFullscreen.call(iframe, {navigationUI: "hide" });
};
</script>