JSFiddle - React, Tailwind, and code Playground
HTML
<div id="banner"></div>
<div id="canvas"></div>
<div id="canvasScreen"></div>
<div id="buttons">
<button id="on">Screen On</button>
<button id="off">Screen Off</button>
</div>
CSS
div#banner {
width:400px;
height:100px;
border:1px solid black;
}
div#canvas {
width:400px;
height:500px;
border:1px solid red;
position:absolute;
}
div#canvasScreen {
width:500px;
height:150px;
position:absolute;
display: none;
z-index:25;
background-color:black;
}
div#buttons {
position:absolute;
top:40px;
left:450px;
}
JavaScript
$('#on').click(function () {
canvasOffset = $('#canvas').offset();
canvasWidth = $('#canvas').width();
canvasHeight = $('#canvas').height();
$('#canvasScreen').width(canvasWidth).height(canvasHeight).offset(canvasOffset).css({'opacity':'0.7', 'display' : 'block'});
console.log("canvasHeight", canvasHeight, "canvasWidth", canvasWidth, "canvasOffset", canvasOffset);
});
$('#off').click(function () {
$('#canvasScreen').css({'display' : 'none'});
});