Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fullscreen mode javascript

//creating a button and linking it to btnClicked()
document.onload=()=>{
  let btn = document.createElement("button");
  btn.textContent = 'Fulscreen!';
  btn.addEventListener('click', btnClicked);
  document.body.append(btn);
}

function btnClicked(){
  document
    .getElementById("%id of the element you want to fullscreen%")
    .requestFullscreen();
}

//to exit fullscreen
document.exitFullscreen();
 
PREVIOUS NEXT
Tagged: #fullscreen #mode #javascript
ADD COMMENT
Topic
Name
2+8 =