JSFiddle - React, Tailwind, and code Playground
HTML
<div class="md-modal md-effect-1" id="modal-1">
<div class="md-content">
<h3>Modal Dialog</h3>
<div>
<p>This is some test div.</p>
<button class="md-close">Close me!</button>
</div>
</div>
</div>
<a href="#" id="mylink">Hover to show custom div</a>
<div class="md-overlay"></div>
CSS
.md-modal {
background-color: white;
color: black;
padding: 10px;
position: fixed;
top: 50%;
left: 50%;
width: 50%;
max-width: 630px;
min-width: 320px;
height: auto;
z-index: 2000;
visibility: hidden;
backface-visibility: hidden;
transform: translateX(-50%) translateY(-50%);
}
.md-show {
visibility: visible;
}
.md-overlay {
position: fixed;
width: 100%;
height: 100%;
visibility: hidden;
top: 0;
left: 0;
z-index: 1000;
opacity: 0;
background: rgba(0,0,0,0.8);
transition: all 0.3s;
}
.md-show ~ .md-overlay {
opacity: 1;
visibility: visible;
}
JavaScript
$("#mylink").hover(function() {
$(".md-modal").addClass('md-show');
});
$(".md-close").click(function(){
$(".md-modal").removeClass('md-show');
});