card flip
by arshad hussain
HTML
<div class="flip">
<div class="card">
<div class="face front">
Signup
<div id="login">login</div>
</div>
<div class="face back">
Signin
<div id="cancel">cancel</div>
</div>
</div>
</div>
CSS
body {
background: white;
}
.flip {
-webkit-perspective: 800;
width: 400px;
height: 400px;
position: relative;
margin: 50px auto;
}
.flip .card.flipped {
-webkit-transform: rotatey(180deg);
}
.flip .card {
width: 100%;
height: 100%;
-webkit-transform-style: preserve-3d;
-webkit-transition: 0.5s;
}
.flip .card .face {
width: 100%;
height: 100%;
position: absolute;
-webkit-backface-visibility: hidden ;
z-index: 2;
font-family: Georgia;
font-size: 3em;
text-align: center;
line-height: 200px;
}
.flip .card .front {
position: absolute;
z-index: 1;
background: skyblue;
color: white;
cursor: pointer;
}
.flip .card .back {
-webkit-transform: rotatey(-180deg);
background: Orange;
color: white;
cursor: pointer;
}
#login
{
position:absolute;
background:orange;
width:100px;
height:50px;
bottom:0px;
font-family: Georgia;
font-size: 30px;
text-align: center;
line-height: 50px;
right:0px;
}
#cancel
{
position:absolute;
background:skyblue;
width:100px;
height:50px;
bottom:0px;
font-family: Georgia;
font-size: 30px;
text-align: center;
line-height: 50px;
right:0px;
}
JavaScript
$('#login').click(function(){
$(this).parents('.card').addClass('flipped');
return false;
});
$('#cancel').click(function(){
$(this).parents('.card').removeClass('flipped');
return false;
});