JSFiddle - React, Tailwind, and code Playground
by web tiki
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section class="container">
<div id="card">
<figure class="front">
<input type="checkbox" id="one" />one
<br></br>
<input type="checkbox" id="two" />two
<br></br>
<input type="checkbox" id="three" />three
<br></br>
</figure>
<figure class="back">
<div id="append"></div>
<div id="close">
<button>close</button>
</div>
</figure>
</div>
</section>
CSS
.container {
width: 200px;
height: 260px;
position: relative;
-ms-perspective: 800px;
perspective: 800px;
}
#card {
width: 100%;
height: 100%;
position: absolute;
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;
transition: transform 1s;
}
#card figure {
display: block;
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
margin: 0px;
padding: 0px;
}
#card .front {
background: red;
}
#card .back {
background: blue;
-ms-transform: rotateY(180deg);
transform: rotateY(180deg);
}
#card.flipped {
-ms-transform: rotateY(180deg);
transform: rotateY(180deg);
}
#card.flipped figure {
backface-visibility: visible;
-webkit-backface-visibility: hidden;
}
#close {
position: absolute;
bottom: 0px;
right: 0px;
color: #fff;
}
JavaScript
$('#one').click(function() {
if ($(this).is(':checked')) {
$("#card").addClass("flipped");
$(".back #append").append("<p>First one</p>")
}
});
$('#two').click(function() {
if ($(this).is(':checked')) {
$("#card").addClass("flipped");
$(".back #append").append("<p>second one</p>")
}
});
$('#three').click(function() {
if ($(this).is(':checked')) {
$("#card").addClass("flipped");
$(".back #append").append("<p>third one</p>")
}
});
$('#close').click(function() {
$("#card").removeClass("flipped");
});