HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<h1>Launch any object into full-screen mode</h1>
<p>Prefixes added for the fullest cross-browser support.<br>Though the method is still unsupported on iPhones.</p>
<div class=wrapper>
<div data-fullScreen class=fullScreen-1>
<!-- Button embedded here by JS, if the method is supported -->
<h2>X-wing silhouette</h2>
<svg class=svg-xWing xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96">
<path d="M11.2 65.2c-1.8-1.14-3.7-2.1-5.55-3.14-.48-.27-1.58-.75-1.77-1.4-.53-1.78 2.4-2.8 3.28-3.4 4.63-3.05 4.4-3.47 9.47-5.8 1.5-.68 3.12-.6 4.54-1.5 2.35-1.34 4.43-3.08 6.7-4.56 1.5-1 3.67-2.03 5.03-3.28-.48-1.1-.67-.9-1.52-1.76-.03-.43-.2-.72-.12-1.26-.63-.88-1.92-.78-2.78-1-2.95-.8-5.94-1.53-8.83-2.54-2.04.83-2.2.33-4.28 1-.67.23-1.2.85-1.9.9-.58.04-1.07-.5-1.64-.64-2.75.66-5.28 1.54-8.08 2.15-.35.15-.33.67-.5 1-.42-.07-.62-.38-1-.5-.67.04-1.27 0-1.77-.12V37.7c1.34-.08 2.5.02 3.27.5 2.73-.63 5.22-1.5 7.83-2.26 1.28-1.33 1.58-.62 3.28-1.26.48-.57-.7-.32-.38-1.14 2.62-.43 3.37-1.1 6.08-.93 3.7.3 5.82 1.2 9.44 1.9 2.8.5 5.65.9 8.45 1.4.3-1.2-1.15-2-1.9-2.5-2.83-2-5.7-3.9-8.57-5.9-3.27-2.2-6.45-4.4-9.6-6.4-.46.3-.92.5-1.75.4-.42 0-.53-.4-.63-.8-2.77.26-5.27.3-8.2.5-.44.4-.38 1.24-.76 1.66-.47.07-.16-.6-.5-.64-.5-.63-1.48-.7-2.15-1.15 0-.64.2-1.06.6-1.4.4-.1 2.2.5 2.4.9 2.2-.15 6.6-.85 8-.75.4-.08.3-.6.5-.9.6-.27 1.3-.17 2-.27 2.7-.4 5.7-1.2 8.4-.37.1.4.3.87.2 1.5-.7.17-1.6.1-1.7.9 5 2.5 9.95 5.1 14.77 7.8 2.5.1 5.44-1.54 7.95-1.13.43-.1.73-.4 1.1-.6 2.1-.14 4.1-1 6.43-.5.56.43.6 1.68.4 2.5-1.37 1.14-4.77.96-4.8 3.05.65.1 2.16-.6 2.8-.8l.22-.27c4.2-.84 7 1.2 10.96 3 .15.7.06 1.57.27 2.16 2.16-.43 3.86-2.2 6.1-2.3 1.26 0 2.5 1.7 1.44 2.7-.72.7-1.9.86-2.5 1.77.05.6.45.9.4 1.6.43.06.8.18 1.37.1.98 1.5 3.5 1.86 2.98 4.44.6.66 2.15.9 2.9 1.16 3.3 1.05 6.56 2.14 9.83 3.25.94.33 2.55 1.17 3.65.76 1.54-.5 1.46-2 3.53-1.4-.05.6.37 1.4 0 1.9 0 .5.8.2.64.9.17.4-.25.3-.4.5-.56.8-1.1 1.7-1.6 2.5-2.1.37-1.76 1.1-3.8 1.78 0 .58.66.5.66 1-.1.6.2 1.47-.1 1.8-.4.17-.8-.14-1.2-.3-.35-.13-.6-.46-1-.6-.75-.2-1.26.25-2-.1-.16-1.1.46-1.3.74-1.9.6.1 1.53-.2 1.9.1.3-.3.6-.6.8-.96 1.5-2.5-3.9-2.68-4.7-2.85-6.92-1.5-11.9-2.8-18.67-4.9-.1.14.16.3.3.4.84.7 1.57 1.6 2.6 1.97.6.1.83-.17 1.25-.26 4.1 3.7 8.5 7 12.8 10.5 1.5 1.27 3.03 2.5 4.52 3.8.37.3.84.6 1 1-.3.8-.4 1.7-1 2.2-.04.2.06.53 0 .73 0 .1-.22.1-.25.2-.26.62-1.04 1.6-1.9 1.8-.06.6-.2 1.2-.5 1.6-.53 0-1.03.58-1.5.26-1.2 1.2-2.1 2.7-2.65 4.3.22 1.37 1.85 1.7.1 3.13-.35.1-.4-.33-.5-.5-.44-.5-.85-1.1-1.4-1.5h-1.4c.18-.72.57-1.25 1.14-1.62.54 0 1.2-.1 1.24.4.6-.74 2.16-3.8 2.4-4.56.2-.44-.1-.3-.14-.75-.4-1 .3-1.96 1-2.14-.2-.5.3-1.1.2-1.65-.13-.4-.55-.62-.9-.9-1.6-1.1-3.25-2.2-4.9-3.25-3.36-2.2-6.75-4.3-10.1-6.45-.55.1-.44.84-.9 1-3 .2-4.8-1.06-6.8 1.3-2.53-.08-2.5-.2-4.92-.77-.4-.7-.8-1.45-1.25-2.15.2-2.1.3-2 .86-4.02-1.3.7-2.1 1.9-3.25 2.8-.32-.2-.82-.2-1.12-.4-6.77 2.6-13.9 5.1-20.9 7.8-1 .4-1.9.65-2.62 1.5-5.6 1.5-5.42 2.06-11.1 3.3-1 .2-3.24.2-4.2-.4z"/>
</svg>
</div>
<div data-fullscreen class=fullScreen-2>
<h2>Tie Fighter silhouette</h2>
<svg class="svg-tieFighter" viewBox="0 0 60 60">
<path d="M60 50.1l-.7.3-5.5-1.5-2.5-7.8-.2-1.3-1-2.6-.3-2-.6-1.3-1.5-5.8H46a18 18 0 01-4.9 3l-.4-.3c.1.4 0 .5-.3.4a8 8 0 00-3.1 2.3c-.2 1.3-.7 2.1-1.6 2.7l-2.9 1.5c-1 .3-2.3.4-4 .1l-2-.5-2.8-2h-2.7l-.2.1H17l-1.5-.5-2.1.4-.3.2 2.8 22.2a8.6 8.6 0 01-4.2 2.3L10 56.8 6 44l-.5-2.7-1.7-5.8c0-1.1-.2-2.1-.6-3v-1l-.4-1.1-.3-3.7-.4-1.3V25l-.8-5.9-.2-.2v-1.3l-1-5.1L0 9.2c2.6.3 4.7 1 6.2 2.3l1.3 2.6L9.1 19v.8l.3.7L12 30.8c.9.1 1.6 0 2.2-.3a9 9 0 015-3.2l.5.2.7-1a7 7 0 003-2l1.5-2.2 2.2-.5c-.1-.5 0-.8.3-1l2-.1c.2.3.5.5 1.2.3.2-.3.6-.3 1.3-.1l3.8 2 3 .4.4.3.3-.3h3.2l1 .1.7.6 2.4-1-.2-.2-.6-5.2-.3-1-.2-2.5-.4-1.3v-1l-.6-2.5-.7-5.5L47.3 0l.6.3L56.2 24l2 14 .5 2.4v1.3L59 43v1.3l.5 2.4.2 2.2.2.2v1.1z"></path>
</svg>
</div>
</div>
<p>May be used on any object: image, video, div…</p>
<p>Code presented here places the button inside of the object, but it's not a requirement, though it may be advisable for accessibility requirements (untested).</p>
<h2>More info</h2>
<ul>
<li>Alternate example: <a target=_blank title="[new window]" href="https://codepen.io/2kool2/pen/QWWWEmY?editors=1000">Andy Warhol looks a scream…</a></li>
<li>MDN: <a target=_blank title="[new window]" href="https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API/Guide">Guide to the Fullscreen API</a></li>
<li>David Walsh: <a target=_blank title="[new window]" href="https://davidwalsh.name/fullscreen">Fullscreen API</a></li>
<li>Craig Buckler: <a target=_blank title="[new window]" href="https://www.sitepoint.com/use-html5-full-screen-api/">How to Use the HTML5 Full-Screen API</a></li>
<li>Useful Angle: <a target=_blank title="[new window]" href="http://usefulangle.com/post/12/javascript-going-fullscreen-is-rare">How to Make the Window Full Screen with JS</a></li>
</ul>
<svg style=display:none>
<!-- Icons adapted from those made by https://www.flaticon.com/authors/freepik off https://www.flaticon.com/ -->
<symbol id="icon-fullScreen-open" viewBox="0 0 96 96">
<path d="M0 62l12 12 19-19 10 10-19 19 12 12H0V62zm96 34H62l12-12-19-19 10-10 19 19 12-12v34zM34 0L22 12l19 19-10 10-19-19L0 34V0h34zm62 0v34L84 22 65 41 55 31l19-19L62 0h34H0h96z"/>
</symbol>
<symbol id="icon-fullScreen-exit" viewBox="0 0 96 96">
<path d="M96 60L82 74l14 13-8 9-14-14-14 14V60h36zm-60 0v36L22 82 8 96l-8-9 14-13L0 60h36zM0 36h36V0L22 14 9 0 0 9l14 13L0 36zm60 0h36L82 22 96 9l-9-9-13 14L60 0v36z"/>
</symbol>
</svg>
<!-- Footer include -->
[[[https://codepen.io/2kool2/pen/mKeeGM]]]
:root {
--textColor: #3b2d4a;
--bgColor: #fffffa;
--borderColorBtn: #000;
--shadowColor: rgba(0,0,0,.25);
--bgColorFS: #c7d7f7;
--shadowColorFS: rgba(0,0,0,.5);
--linkColor: blue;
--linkColorHover: #000;
--textWeight: 400;
}
/* If the OS has dark mode set then... */
/* - change light <--> dark for testing */
@media (prefers-color-scheme: dark) {
:root {
--textColor: #fff;
--bgColor: #000;
--borderColorBtn: #777;
--shadowColor: rgba(0,0,0,.5);
--bgColorFS: #3b2d4a;
--shadowColorFS: #000;
--linkColor: hsla(214,100%,72%,1);
--linkColorHover: #fff;
--textWeight: 300;
}
}
html {box-sizing: border-box;}
*,
*::before,
*::after {box-sizing: inherit;}
body {
margin: 1rem;
font-family: sans-serif;
font-weight: var(--textWeight);
text-rendering: optimizeLegibility;
line-height: 1.5;
color: var(--textColor);
text-align: center;
background-color: var(--bgColor);
}
h1 {
font-size: 1.5rem;
line-height: 1.2;
font-weight: 300;
margin: 1.5rem 0 1rem;
}
h2 {
font-size: calc(1.25rem + ((1vw - 0.48rem) * 0.6944));
line-height: 1.2;
font-weight: 300;
margin: 1rem 0 0;
}
p + h2 {
font-size: 1.25rem;
margin: 2rem 0 1rem;
}
ul {
list-style: none;
text-align: left;
max-width: 30rem;
margin: 1rem auto;
}
a,
a:visited {
color: var(--linkColor);
text-decoration-color: hsla(211,100%,72%,.5);
transition: all .3s;
}
a:hover,
a:active {
color: var(--linkColorHover);
text-decoration-color: var(--linkColorHover);
}
.wrapper {
max-width: 24rem;
margin: 2rem auto;
}
[class^="fullScreen-"] {
margin: 2rem 0;
padding: 1rem;
box-shadow: 0 .125rem .25rem var(--shadowColorFS);
position: relative;
background-color: var(--bgColorFS)
}
[class^="fullScreen-"]:-webkit-full-screen {
width: 100%;
height: 100%;
}
/* Button added by JS, if supported */
[class^="fullScreen_btn"]::-moz-focus-inner {
border: 0;
}
[class^="fullScreen_btn"] {
position: absolute;
padding: .5rem;
background-color: var(--bgColorFS);
border: .125rem solid var(--borderColorBtn);
border-radius: .24rem;
box-shadow: 0 .125rem .25rem var(--shadowColor);
top: .5rem;
left: .5rem;
z-index: 2;
color: var(--linkColor);
font-size: inherit;
cursor: pointer;
transition: all .3s;
}
[class^="fullScreen_btn"]:hover {
color: var(--textColor);
}
[class^="fullScreen_btn"]:focus {
border-color: var(--linkColor);
outline: none;
}
.fullScreen_btn-open {
transform: translate(-30%, -30%);
}
.fullScreen_btn-open:hover,
.fullScreen_btn-open:focus {
box-shadow: 0 .25rem .5rem #000;
transform: scale(1.2) translate(-25%, -25%);
}
.fullScreen_btn-exit {
transform: scale(1.2) translate(25%, 25%);
}
.fullScreen_btn-exit:hover,
.fullScreen_btn-exit:focus {
transform: scale(1) translate(25%, 25%);
}
[class^="fullScreen_svg"] {
display: block;
width: 1.75rem;
height: 1.75rem;
fill: currentColor;
transition: fill .3s;
}
.fullScreen_svg-open {}
.fullScreen_svg-exit {}
.svg-xWing,
.svg-tieFighter {
max-width: 100vw;
max-height: 100vh;
fill: currentColor;
filter: drop-shadow(.25vw .25vw .25vw rgba(0,0,0,.75));
}
/* a wee drop of the grain */
body,
[class^="fullScreen-"] {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='1200' height='256' viewBox='0 0 1200 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.4'%3E%3C/feTurbulence%3E%3C/filter%3E%3C/defs%3E%3Crect height='256' width='1200' filter='url(%23noise)' opacity='.3'/%3E%3C/svg%3E");
}
var supportsES6 = function() {
// https://gist.github.com/bendc/d7f3dbc83d0f65ca0433caf90378cd95
try {
new Function("(a = 0) => a");
return true;
}
catch (err) {
return false;
}
}();
// Add a full-screen toggle button where supported.
// Version 2.5 07/10/2019
// - Adding cross-browser support using prefixes.
function launchFullWindow(config) {
"use strict";
if (!supportsES6) return false;
// Exit if unsupported
if (!(
document.fullscreenEnabled ||
document.webkitFullscreenEnabled ||
document.mozFullScreenEnabled ||
document.msFullscreenEnabled)) return false;
let cfg = {
launchObjSelect : '[data-fullScreen]',
launchBtnClass : 'fullScreen_btn',
svgClass : 'fullScreen_svg',
open : {
icon : 'icon-fullScreen-open',
extension : '-open',
label : 'Launch into full screen',
title : 'Full screen [f, f11]'
},
exit : {
icon : 'icon-fullScreen-exit',
extension : '-exit',
label : 'Exit full screen',
title : 'Exit full screen [f, f11, esc]'
}
};
// Blend the parameter config into the default cfg
Object.assign(cfg, config);
const svgData = {
open : {},
exit : {}
}
// Get symbols from the SVG definitions in the HTML
const setSvgData = (_ => {
const getData = param => {
const symbol = document.getElementById(cfg[param].icon);
if (!symbol) return false;
svgData[param].class = cfg.svgClass;
svgData[param].icon = cfg[param].icon;
svgData[param].symbol = symbol.innerHTML;
svgData[param].viewBox = symbol.getAttribute('viewBox');
};
getData('open');
getData('exit');
})();
const _openFullScreen = obj => {
if (obj.requestFullscreen) {
obj.requestFullscreen();
} else if (obj.webkitRequestFullscreen) {
obj.webkitRequestFullscreen();
} else if (obj.mozRequestFullScreen) {
obj.mozRequestFullScreen();
} else if (obj.msRequestFullscreen) {
obj.msRequestFullscreen();
}
};
const _exitFullScreen = _ => {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
};
const _hasFullScreenElement = _ =>
document.fullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement ||
document.msFullscreenElement;
const _instantiateLaunchObj = launchObj => {
const _getCfg = (param, toOpen) => cfg[toOpen ? 'open' : 'exit'][param];
const _getSvgString = toOpen => {
const param = _getCfg('extension', toOpen).substr(1);
return `<svg class="${svgData[param].class}" aria-hidden="true" viewbox="${svgData[param].viewBox}">${svgData[param].symbol}</svg>`;
}
const _setBtnAttr = toOpen => {
btn.className = cfg.launchBtnClass + _getCfg('extension', toOpen);
btn.title = _getCfg('title', toOpen);
btn.setAttribute('aria-label', _getCfg('label', toOpen));
btn.innerHTML = _getSvgString(toOpen);
}
// Check to see if a button already exists in the html
let btn = launchObj.querySelector('.' + cfg.launchBtnClass);
if (!btn) {
// If not, create one
btn = document.createElement('button');
launchObj.prepend(btn);
}
_setBtnAttr(true);
const _toggleFullScreen = _ => {
if (!_hasFullScreenElement()) {
_openFullScreen(launchObj);
} else {
_exitFullScreen();
}
btn.focus();
};
const _onFullscreenChange = _ =>
_setBtnAttr(!_hasFullScreenElement());
{
btn.addEventListener('click', _toggleFullScreen);
// Toggle attr this way because esc key is not detected but change is!
document.addEventListener('fullscreenchange', _onFullscreenChange);
document.addEventListener('mozfullscreenchange', _onFullscreenChange);
document.addEventListener('webkitfullscreenchange', _onFullscreenChange);
document.addEventListener("MSFullscreenChange", _onFullscreenChange);
// Toggle if the f, or f11, key is pressed
document.addEventListener('keydown', event => {
if (event.keyCode === 70 || event.keyCode === 112) {
_toggleFullScreen();
}
});
}
}
// Multiple objects to launch
const objs = document.querySelectorAll(cfg.launchObjSelect);
for (const obj of objs) {
_instantiateLaunchObj(obj);
}
}
// Attaches to any object with data-fullScreen attribute by default.
// Pass in a customised config to overide default settings.
launchFullWindow();
// Specific object(s) by selector
// launchFullWindow( {launchObjSelect : '.fullScreen-3'} );
// (function (window, document) {
// "use strict";
// if (!supportsES6) return false;
// // Exit if unsupported
// if (!(
// document.fullscreenEnabled ||
// document.webkitFullscreenEnabled ||
// document.mozFullScreenEnabled ||
// document.msFullscreenEnabled)) return false;
// const cfg = {
// launchObjId : 'fullScreen',
// launchBtnClass : 'fullScreen_btn',
// icon : '#icon-fullScreen',
// svgClass : 'fullScreen_svg',
// open : {
// extension : '-open',
// label : 'Launch into full screen',
// title : 'Full screen (f)'
// },
// exit : {
// extension : '-exit',
// label : 'Exit full screen',
// title : 'Exit full screen (f)'
// }
// };
// const launchObj = document.getElementById(cfg.launchObjId);
// if (!launchObj) return false;
// const _getCfg = (param, toOpen) =>
// cfg[toOpen ? 'open' : 'exit'][param];
// const _getSvgString = toOpen => {
// const ext = _getCfg('extension', toOpen);
// return `<svg class="${cfg.svgClass + ext}" aria-hidden="true"><use xlink:href="${cfg.icon + ext}" /></svg>`;
// };
// const _setBtnAttr = toOpen => {
// btn.className = cfg.launchBtnClass + _getCfg('extension', toOpen);
// btn.title = _getCfg('title', toOpen);
// btn.setAttribute('aria-label', _getCfg('label', toOpen));
// btn.innerHTML = _getSvgString(toOpen);
// };
// let btn;
// if (!launchObj.querySelector('.' + cfg.launchBtnClass)) {
// btn = document.createElement('button');
// _setBtnAttr(true);
// launchObj.prepend(btn);
// }
// const _openFullScreen = obj => {
// if (obj.requestFullscreen) {
// obj.requestFullscreen();
// } else if (obj.webkitRequestFullscreen) {
// obj.webkitRequestFullscreen();
// } else if (obj.mozRequestFullScreen) {
// obj.mozRequestFullScreen();
// } else if (obj.msRequestFullscreen) {
// obj.msRequestFullscreen();
// }
// };
// const _exitFullScreen = _ => {
// if (document.exitFullscreen) {
// document.exitFullscreen();
// } else if (document.webkitExitFullscreen) {
// document.webkitExitFullscreen();
// } else if (document.mozCancelFullScreen) {
// document.mozCancelFullScreen();
// } else if (document.msExitFullscreen) {
// document.msExitFullscreen();
// }
// };
// const _hasFullScreenElement = _ =>
// document.fullscreenElement ||
// document.webkitFullscreenElement ||
// document.mozFullScreenElement ||
// document.msFullscreenElement;
// const _toggleFullScreen = _ => {
// if (!_hasFullScreenElement()) {
// _openFullScreen(launchObj);
// } else {
// _exitFullScreen();
// }
// btn.focus();
// };
// const _onFullscreenChange = _ =>
// _setBtnAttr(!_hasFullScreenElement());
// {
// btn.addEventListener('click', _toggleFullScreen);
// document.addEventListener('fullscreenchange', _onFullscreenChange);
// document.addEventListener('mozfullscreenchange', _onFullscreenChange);
// document.addEventListener('webkitfullscreenchange', _onFullscreenChange);
// document.addEventListener("MSFullscreenChange", _onFullscreenChange);
// // Also toggle if the f key or f11 is pressed
// document.addEventListener('keydown', event => {
// if (event.keyCode === 70 || event.keyCode === 122) {
// _toggleFullScreen();
// }
// });
// };
// }(window, document));
Also see: Tab Triggers