JSFiddle - React, Tailwind, and code Playground
HTML
<script>
function myFunction(x) {
var popup = document.querySelectorAll('.popup')[0];
if(x == 'show'){
popup.style.display = 'block';
setTimeout(()=> {
popup.style.opacity = 1;
},50);
}
if(x == 'close'){
popup.style.opacity = 0,
setTimeout(()=> {
popup.style.display = 'none';
},700);
}
}
</script>
<div onclick="myFunction('show')">Click me!</div>
<div class="popup">
<table class="popuptext" id="myPopup" border='1'>
<div id="close" onclick="myFunction('close')">X</div>
<tr>
<th>Номер телефона</th>
<th>Имя</th>
<th>Заказ</th>
<th>Дата поступления заказа</th>
<th>Примечание</th>
</tr>
<tr>
<td><input type="text" value="p_nr" id="p_nr" name="p_nr" /></td>
<td><input type="text" value="p_name" id="p_name" name="p_name" /></td>
<td><input type="text" value="p_product" id="p_product" name="p_product" /></td>
<td><input type="text" value="p_stadate" id="p_stadate" name="p_stadate" /></td>
<td><input type="text" value="p_comment" id="p_comment" name="p_comment" /></td>
</tr>
</div>
CSS
/* Popup container */
.popup {
/* display: none; */
opacity: 0;
position: relative;
cursor: pointer;
transition: 0.7s;
}
/* The actual popup (appears on top) */
.popup .popuptext {
transition: 0.7s;
/* opacity: 0; */
width: 160px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 40px 10px 10px 10px;
position: absolute;
z-index: 1;
/* bottom: 125%; */
left: 0%;
margin-top: 50px;
}
/* Popup arrow */
.popup .popuptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}
/* Toggle this class when clicking on the popup container (hide and show the popup) */
.popup .show {
visibility: visible;
-webkit-animation: fadeIn 1s;
animation: fadeIn 1s;
}
/* Add animation (fade in the popup) */
@-webkit-keyframes fadeIn {
from {opacity: 0;}
to {opacity: 1;}
}
@keyframes fadeIn {
from {opacity: 0;}
to {opacity:1 ;}
}
#close{
width: 35px;
height: 30px;
/* background-color: #000; */
color: #fff;
text-align: center;
line-height: 30px;
position: relative;
z-index: 2;
left: 878px;
top: 88px;
border-radius: 5px;
border: 1px solid;
}
#close:hover{
background-color: #000;
}