JSFiddle - React, Tailwind, and code Playground

HTML

<iframe class="video" width="640" height="360" src="https://www.youtube.com/embed/5HLtpoxOeuM" frameborder="0" allowfullscreen></iframe>
<br><br>

<button class="switch">turn off light</button>
(to turn on light - click somewhere)

<div id='persoff'></div>

CSS

.video {
position:relative;
z-index:102;
}
#persoff {
background:#000;
opacity:0.9;
filter:alpha(opacity=90);
position:fixed;
left:0;
top:0;
width:100%;
height:100%;
z-index:100;
}

JavaScript

var per = 0;
$(document).ready(function(){
  $("#persoff").css("height", $(document).height()).hide();
  $(document).click(function(e) {
	if(!$(e.target).hasClass('switch') && per == 1) {
	  $("#persoff").toggle();
	  per = 0;
	}
  });
  $(".switch").click(function(){
    $("#persoff").toggle();
	per += 1;
    if (per == 2) {
	  per = 0;
	}
  });
});