The snippet here, as well as another interactive IDE running in an iframe (which almost all of them do), do not allow full-screen code to work. Therefore, to see this demo for work, you need to copy the n insert to the real site or you can also do it locally.
It uses full screen API , it is real full screen
Demo
Doesn't work due to SO security measures (not allowfullscreenin iframe)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1, user-scalable=no">
<style>
#t:-webkit-full-screen {
min-width: 100%;
min-height: 100%;
display: block;
}
</style>
</head>
<body>
<textarea id="t" cols="30" rows="10"></textarea>
<button id='btn'>Full Screen</button>
<script>
var el = document.getElementById('t');
document.getElementById('btn').onclick = function() {
fs(el);
};
var fsActive = function() {
return !!(document.webkitFullscreenElement || document.mozFullScreenElement || document.fullscreenElement);
};
function fs(target) {
if (!fsActive()) {
if (target.webkitRequestFullscreen) {
target.webkitRequestFullscreen();
} else if (target.mozRequestFullScreen) {
target.mozRequestFullScreen();
} else if (target.requestFullscreen) {
target.requestFullscreen();
}
} else {
if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.exitFullscreen) {
document.exitFullscreen();
}
}
}
</script>
</body>
</html>
Run codeHide result source
share