JSFiddle - React, Tailwind, and code Playground
HTML
<a id="formLink" href="javascript:void(0)">Обратная связь</a>
<div id="box">
<div id="box-inner">
</div>
<div id="container">
<iframe src="//fiddle.jshell.net/4kncL/1/show"></iframe>
</div>
</div>
CSS
* {
font-family: Arial;
}
#box {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
}
#box-inner {
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
background: blue;
opacity: 0.3;
display: none;
}
#box #container {
position: absolute;
top: 0; bottom: 0; right: 0; left: 0; /* центрирование */
margin: auto; /* центрирование */
height: 15em;
width: 25em;
border: 1px solid black;
background: white;
padding: 1%;
}
iframe {
width: 100%;
height: 100%;
border: none;
}
JavaScript
document.getElementById("formLink").onclick = function()
{
document.getElementById("box").style.display = "block";
document.getElementById("box-inner").style.display = "block";
}
document.getElementById("box").onclick = function(e)
{
if(e.toElement == document.getElementById("box-inner"))
{
document.getElementById("box").style.display = "none";
document.getElementById("box-inner").style.display = "none";
}
}