I looked for a little bit about the same in google and most people talk to use
position: absolute;
z-index:9999;
width:100%;
height:100%;
top:0;
left:0;
But the code above only works to by in fullscreen inside the window, and that's not what I want, I want to use Fullscreen for real, the whole screen of the user and then I found the code below:
if (!document.fullscreenElement &&
!document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) {
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
} else if (document.documentElement.msRequestFullscreen) {
document.documentElement.msRequestFullscreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
This works perfectly, but puts the entire document in full screen, and I just want a specific div on fullscreen, how can I do that?
They marked that question is the same, but it is not, the solutions presented in it are the same ones I am asking here to try to adapt to my use. Is there any way to enable browser full screen with Javascript?