DEV Community

Cover image for Enter Full-Screen Mode with JavaScript - Fullscreen
ali-dev-hash
ali-dev-hash

Posted on

Enter Full-Screen Mode with JavaScript - Fullscreen

Enter Full-Screen Mode with JavaScript - Fullscreen

demo == > https://codepen.io/Bilal1909/full/XWpOQEO

How to use JavaScript to view an element in fullscreen mode


To open an element in fullscreen, we use the element.requestFullscreen() method:

Fullscreen Document

To open the whole page in fullscreen, use the document.documentElement instead of document.getElementById("element"). In this example, we also use a close function to close the fullscreen:

Top comments (0)