/* Fullscreen mode */
var launchFullscreen = function() {
var i, l = ['requestFullscreen','webkitRequestFullscreen','mozRequestFullScreen','msRequestFullscreen]', e = document.documentElement;
for( i = 0; i < l.length; i++ ) if( e[l[i]] !== undefined ) {
(e[l[i]])(); break;
}
}, checkFullscreen = function() {
return Boolean( document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement );
}, cancelFullscreen = function() {
var i, l = ['exitFullscreen','webkitExitFullscreen','mozCancelFullScreen','msExitFullscreen'];
for( i = 0; i < l.length; i++ ) if( document[l[i]] !== undefined ) {
(document[l[i]])(); break;
}
};
Пример
// Проверка и активация нужного режима
checkFullscreen () ? cancelFullscreen() : launchFullscreen();