showing results for - "full screen a div"
Claudia
18 Nov 2018
1$('#toggle_fullscreen').on('click', function(){
2  // if already full screen; exit
3  // else go fullscreen
4  if (
5    document.fullscreenElement ||
6    document.webkitFullscreenElement ||
7    document.mozFullScreenElement ||
8    document.msFullscreenElement
9  ) {
10    if (document.exitFullscreen) {
11      document.exitFullscreen();
12    } else if (document.mozCancelFullScreen) {
13      document.mozCancelFullScreen();
14    } else if (document.webkitExitFullscreen) {
15      document.webkitExitFullscreen();
16    } else if (document.msExitFullscreen) {
17      document.msExitFullscreen();
18    }
19  } else {
20    element = $('#container').get(0);
21    if (element.requestFullscreen) {
22      element.requestFullscreen();
23    } else if (element.mozRequestFullScreen) {
24      element.mozRequestFullScreen();
25    } else if (element.webkitRequestFullscreen) {
26      element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
27    } else if (element.msRequestFullscreen) {
28      element.msRequestFullscreen();
29    }
30  }
31});
32#container{
33  border:1px solid red;
34  border-radius: .5em;
35  padding:10px;
36}
37<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
38<div id="container">
39  <p>
40    <a href="#" id="toggle_fullscreen">Toggle Fullscreen</a>
41  </p>
42  I will be fullscreen, yay!
43</div>
44
Oskar
24 Nov 2018
1$('#toggle_fullscreen').on('click', function(){
2  // if already full screen; exit
3  // else go fullscreen
4  if (
5    document.fullscreenElement ||
6    document.webkitFullscreenElement ||
7    document.mozFullScreenElement ||
8    document.msFullscreenElement
9  ) {
10    if (document.exitFullscreen) {
11      document.exitFullscreen();
12    } else if (document.mozCancelFullScreen) {
13      document.mozCancelFullScreen();
14    } else if (document.webkitExitFullscreen) {
15      document.webkitExitFullscreen();
16    } else if (document.msExitFullscreen) {
17      document.msExitFullscreen();
18    }
19  } else {
20    element = $('#container').get(0);
21    if (element.requestFullscreen) {
22      element.requestFullscreen();
23    } else if (element.mozRequestFullScreen) {
24      element.mozRequestFullScreen();
25    } else if (element.webkitRequestFullscreen) {
26      element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
27    } else if (element.msRequestFullscreen) {
28      element.msRequestFullscreen();
29    }
30  }
31});
similar questions
javascript full screen
queries leading to this page
page full screen javascripthow to show an element full screen csshow to make a div full boxadd a fullscreen divcss width full screencss how to full screendiv for full screenfull screen when click divjs make screen fulljavascript full screen icss full width screenmake div fullscreenmake div full screen widthcss always full divhtml how to make div full screenfull screenjavascript make div fullscreencenter div on full screenmake div full screen in smaller divfull screen divdiv scroll full screenfull screen in divhow to cover a div full screenhow to make a div in full screenmake a div occupy full screenjs make div fullscreenmake a div take full screenfull screen any div using jsfull page div htmldiv cover entire screenhow to make div width full screenhow to make a div full screenheight full screen cssmake div full screen on click how to make div full screen heightjavascript full screencss make div height full screenhow to make a full screen divhow to make div take full screenhow to make an html element full screenmake content fit to screen cssdisplay div full screencss div full screen heightfull screen mode for a divhow to show an element full screenhtml div full screenfull screen container cssjs create fullscreen divfull screen view javascript in fit cssmake element occupy full page size using jsiframe full screen htmlmake a div to take entire screenhow to make full screen in css make element full screencss height full screendiv tag cover full screenset div to full screenhow to make a page full screen cssdiv with full screen viewfull page div cssfull screen of div in jshtml how to make div fullscreenhow to div fullscreen javascrifull screen using javascriptfull screen view on divbest way to make a div full screenhow to display the page on full screen csscss stretch div full screenmake div full screen height cssmake div full height of screencss position fixed full screenmake div fullscreen csshow to make a div full screen cssfullscreen div javascriptcss when on full screenhtml full screen csscss full screencss fullscreen divmake div take full screenhow to make div full page make div height full screenhtml div fill screenmake div take full height of screenhow to make a div occupy full screendisplay full screen cssdiv height full screenjavascript make element full screendiv to cover whole screenfull screen div on clickfull screen in cssmake div full screen 28 29full screen a divmake a div full screenfill whole screen html5javascript fullscreen divmake width as full screen cssdiv into fullscreen jsmake div full screen container full screen cssmake a section full screen cssfull screen div cssjavascript show full screenhtml fullscreen divdiv with full screenjavascript always full screenmake div cover full screendiv on full screenmake div cover entire screenmake element fullscreen jshow to make the window full screen with javascriptmake div full screen jquerycss make div full screenhow to full screen container cssfull screen with cssput a div to fullscreen csscss div take full screencss div whole screenhow to fit div in screencss div full pagecss full screen andfull screen html div cssfull page divset full screen javascriptcss full screen classhtml div full screen heightcss div full width of screenjavascript resize div to full screencss make element full screenfullscreen divcss make div full screen on mobilejs set div fullscreenhow to fill the screen with a div tag in htmlmake div full screen cssdiv adjust to full screenmake div fullscreen overflowdiv full screencss div full screencss container fit to screencss full screen divisionjavascript fullscreenmaking div full screendiv cover full screenjs fullscreen on divmake div take up entire pagediv whole screenw3schools div full screencss view div in full screencss element full screendiv on full screen csshow to make a div go full screenhow to make a div full screen javascriptfull screen html divdiv full screen cssfill up whole screen divmake a div full screen cssdiv to fill screen div takes full screenshow an element full screen htmlsection full screen csshtml make div fill screenfull screen element cssfull screen fixed size divcss make height full screenhow to set full screen html css jshow to make a div full screen with cssjavascript full screen divmake container fit whole screenfull screen divmake div full screen jscss how to make div full screen anpther belowhow to give full screen width divjs fullscreen elementdiv fullscreen csscreate div full screencss make section full screenhow to make a div full screen javascript browser full screen apicss set div full screenscroll div full screenhow to fullscreen an element in jshow to make a div full screen withresponsive full screen divcss make container fit screenhow to make div take up whole pagediv full height of screencss go full screen with certain divmaking div of full screenfit a div as full screenjavascript make div height full screenjavascript make element fullscreenfull screen div containerfull screen css widthmake div take full screen csshtml full screen divcss make a div full screenjavascript div fullscreendiv take full screencss make div fullscreenhtml div full scrren heightdiv full pagediv taking full screen spaceopen div fullscreen width 100html css full screenhtml full screen javascripthow to make one div full screenfullscreen div htmljs fullscreen divhow to apply div to full screen in csssdiv to full screen heightparticular div full screenhow to make a div cover full screenstretch div on full screenfullscreen the divhtml css full screen elementdisplay full screen in csshow to make div tag fullscreendiv full width of screen csscss media full screenhtml5 fullscreen divfullscreen jsmake div full screen javascriptcss container full screencss overlay full screenhow to have elemetn take up full screenhow to make a div full length of the screenentire screen divdiv cover full screen csshow to make div full screen in htmldiv fill entire screenhow to set full with in divhtml create full screen divfull screen div javascriptmaximize div to full screendiv full windowhtml css make div full screen sizefull screen html cssfull screen div in jsset div to full screen heightjavascript show div fullscreentake entire screen div cssdiv cover screenhow to make container fill the whole screen jscss make div take entire screenmake div full screen even if parent notturn full screen javascripthtml full screenchrome fullscreen divcss stretch container to fit screencss whole srcreen but just in another divclass full screen csscss make div go full screenmake div take up whole pagemake entire screen white jqueryhow to make a div to contain full screenjavascript fullscreen elementcss display full screenwidth full screen csshow to make a div take up the whole pagehow to make div full screen htmlmake div full width of screenhow to make full screen of div htmlopen div fullscreenhow to display div with full width on screenhtml make div fullscreendiv full size of screendiv full page csshow to make a div display on the full screenhow make full screen div tagcss fullscreen sectionhow to fill screen with div in htmlcover entire screen in divcss full screen height divfull screen height divhtml make div full screenset a div to full screenmake element full screen htmldiv full screen with scrollcss fullscreen overlay divcss full screen containerjavascript fullscreen specific divdiv occupy full screendiv full width of screenjquery div fullscreencss full screen divdiv full screen backgroundfull screen in div with javascripthow to make something full screen in cssdiv tag full screenmake container fit screenmake a div width full screen widthat a time only show one div full screen on jquerycss div full height of screencss make div fit screencover div entire screenhow to set div to full screen in cssdiv in full screenhtml div full screen sizecss make section full screen heighthow to make div full screendiv fullscreenmake a div take up the whole screenhow to make a div always full screenjs display container in the whole screenmake divs fullscreen and scrolldiv entire screenfullscreen a div javascriptfullscreen section div javascriptdiv take the whole screenfull screen a div