 <p>I wrote a jQuery function:</p> <pre><code>$.fn.fullscreen = function(target){ var elem = $(target)[0]; $d = $(document); if(elem.requestFullscreen || elem.msRequestFullscreen || elem.mozRequestFullScreen || elem.webkitRequestFullscreen){ function FSon(){ $d.trigger('fullscreen').trigger('fullscreenOn').data('fullscreen',true); } function FSoff(){ $d.trigger('fullscreen').trigger('fullscreenOff').data('fullscreen',false); } $d.data('fullscreen',false) .on('fullscreenchange',function(){ if(document.fullscreen) FSon(); else FSoff(); }).on('mozfullscreenchange',function(){ if(document.mozFullScreen) FSon(); else FSoff(); }).on('webkitfullscreenchange',function(){ if(document.webkitIsFullScreen) FSon(); else FSoff(); }).on('MSFullscreenChange',function(){ if(document.msFullscreenElement) FSon(); else FSoff(); }); this.click(function(){ if(elem.requestFullscreen){ elem.requestFullscreen(); }else if(elem.mozRequestFullScreen){ elem.mozRequestFullScreen(); }else if(elem.webkitRequestFullscreen){ elem.webkitRequestFullscreen(); }else if(elem.msRequestFullscreen){ elem.msRequestFullscreen(); } }); }else{ this.remove(); } }; </code></pre> <p>It provides the following features:</p> <ul> <li>Cross-browser (Unless the browser doesn't support <code>requestFullscreen</code> or its prefixed methods)</li> <li>Issues events on <code>$(document)</code>: <code>fullscreen</code> for on/off and <code>fullscreenOn</code>/<code>fullscreenOff</code>.</li> <li>Adds jQuery <code>.data</code> to <code>$(document)</code>: <code>fullscreen</code> is a boolean value.</li> </ul> <p>You can call it like so:</p> <pre><code>$("#myButton").fullscreen("#elementToMakeFullscreen"); </code></pre> <p>Here is the function compressed:</p> <pre><code>function n(){$d.trigger("fullscreen").trigger("fullscreenOn").data("fullscreen",true)}function r(){$d.trigger("fullscreen").trigger("fullscreenOff").data("fullscreen",false)}$d.data("fullscreen",false).on("fullscreenchange",function(){if(document.fullscreen)n();else r()}).on("mozfullscreenchange",function(){if(document.mozFullScreen)n();else r()}).on("webkitfullscreenchange",function(){if(document.webkitIsFullScreen)n();else r()}).on("MSFullscreenChange",function(){if(document.msFullscreenElement)n();else r()});this.click(function(){if(t.requestFullscreen){t.requestFullscreen()}else if(t.mozRequestFullScreen){t.mozRequestFullScreen()}else if(t.webkitRequestFullscreen){t.webkitRequestFullscreen()}else if(t.msRequestFullscreen){t.msRequestFullscreen()}})}else{this.remove()}} </code></pre>