-2

I want to make a button that will toggle my website to go full screen. I am not sure about how to?

Endless
  • 24,091
  • 10
  • 82
  • 106
Sid Chase
  • 27
  • 4

1 Answers1

5

look what a little bit of searching brought up from google

function toggleFullScreen() {
  if (!document.fullscreenElement) {
      document.documentElement.requestFullscreen();
  } else {
    if (document.exitFullscreen) {
      document.exitFullscreen(); 
    }
  }
}
Endless
  • 24,091
  • 10
  • 82
  • 106