JSFiddle - React, Tailwind, and code Playground
by zlojnaxa
HTML
<script>
function myFunction() {
var popup = document.getElementById("myPopup");
+window.getComputedStyle(popup, null).getPropertyValue('opacity') == 1 ? (popup.style.opacity = 0,setTimeout(()=> {popup.style.visibility = 'hidden';},700)) : (popup.style.opacity = 1,popup.style.visibility = 'visible');
}
</script>
<div class="popup" onclick="myFunction()">Click me!
<table class="popuptext" id="myPopup" border='1'>
<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 {
position: relative;
display: inline-block;
cursor: pointer;
}
/* 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: 50%;
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 ;}
}