Flip card 2
Klicke auf der Karte um sie zu drehen
Der hier verwendete Code
<style>
body {
background: #333;
}
.flipper {
transform: rotateY(180deg);
}
.flipper1 {
transform: rotateY(0deg);
}
.flip-container,
.front,
.back {
width: 300px;
height: 500px;
text-align: center;
font-size: 30px;
border-radius: 20px;
}
.flipper ,.flipper1{
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
.front,
.back {
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
.front {
z-index: 2;
background-color: tomato;
color: white;
}
.back {
transform: rotateY(180deg);
background-color: lightblue;
}
</style>
<body>
<div id="card" class="flip-container">
<div class="flipper">
<div class="front">
<p> Dies ist die Vorderseite der Karte </p>
</div>
<div class="back">
<p> Dame </p>
</div>
</div>
</div>
<script>
function showbanner() {
var element = document.getElementById('card');
if(element.classList.contains('flipper')) {
element.classList.remove('flipper')
element.classList.add('flipper1')
} else {
element.classList.remove('flipper1')
element.classList.add('flipper')
}
}
document.getElementsByTagName('body')[0].addEventListener("click" , showbanner);
</script>
</body>