JSFiddle - React, Tailwind, and code Playground
by tjerabek
HTML
<div class="item">
Ahoj světe!
<a href="" class="close">Close</a>
</div>
<a href="" class="open">Open</a>
CSS
.item{
background: #242420;
color: white;
padding: 50px;
position: fixed;
width: 600px;
height: 380px;
left: 50%;
top: 50%;
margin-left: -300px;
margin-top: -190px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.2);
box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.2);
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transform: rotatex(180deg) translate3d(0, 20%, -100px) scale(0.2);
-moz-transform: rotatex(180deg) translate3d(0, 20%, -100px) scale(0.2);
-ms-transform: rotatex(180deg) translate3d(0, 20%, -100px) scale(0.2);
-o-transform: rotatex(180deg) translate3d(0, 20%, -100px) scale(0.2);
transform: rotatex(180deg) translate3d(0, 20%, -100px) scale(0.2);
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.item.open{
-webkit-backface-visibility: visible;
-moz-backface-visibility: visible;
-ms-backface-visibility: visible;
-o-backface-visibility: visible;
-webkit-transform: rotatex(0deg) translate3d(0, 0, 0) scale(1);
-moz-transform: rotatex(0deg) translate3d(0, 0, 0) scale(1);
-ms-transform: rotatex(0deg) translate3d(0, 0, 0) scale(1);
-o-transform: rotatex(0deg) translate3d(0, 0, 0) scale(1);
transform: rotatex(0deg) translate3d(0, 0, 0) scale(1);
}
JavaScript
$('.open').click(function() {
$('.item').addClass('open');
return false;
});
$('.close').click(function() {
$('.item').removeClass('open');
return false;
});