Une fenêtre modale simple avec un peu de JS et pas de librarie.
<script>
function openModal(id) {
let modal = document.getElementById(id);
modal.classList.add('animate-modal');
setTimeout(function(){ modal.classList.add('animated-modal'); modal.classList.remove('animate-modal'); }, 400);
}
function closeModal(id) {
let modal = document.getElementById(id);
modal.classList.add('animate-out-modal');
modal.classList.remove('animated-modal');
setTimeout(function(){ modal.classList.remove('animate-out-modal'); }, 400);
}
</script><style>
/* ===================================================================*/
/* ============================= MODAL ============================ */
/* ===================================================================*/
.modal-mahii {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background: rgba(31,32,38,.7);
z-index: 99;
}
.modal-mahii-content {
position: fixed;
top: 10vh;
left: 50%;
transform: translateX(-50%);
width: 600px;
max-width: 95vw;
background-color: #fff;
padding: 30px 0 30px 30px;
}
.modal-mahii-content-inner {
max-height: 70vh;
overflow: auto;
}
.modal-mahii-header {
padding-bottom: 12px;
}
.close-modal {
position: absolute;
top: 0px;
right: 15px;
cursor: pointer;
font-size: 4rem;
color: #000;
}
.animate-modal {
display: block !important;
opacity: 0;
animation: fadeIn 0.4s ease-in-out 1 forwards;
}
.animated-modal {
display: block !important;
opacity: 1;
}
.animate-out-modal {
display: block !important;
animation: fadeIn 0.4s ease-in-out 1 reverse backwards;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
</style>