K
K
|
<html> <head> <style> /*Card Flip*/ .card-container { width: 150px; height: 150px; position: relative; border: 1px solid #ccc; -webkit-perspective: 800px; -moz-perspective: 800px; -o-perspective: 800px; perspective: 800px; float: left; margin: 50px 50px 50px 50px; cursor: pointer; } .card { width: 100%; height: 100%; position: absolute; -webkit-transition: -webkit-transform 1s; -moz-transition: -moz-transform 1s; -o-transition: -o-transform 1s; transition: transform 1s; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; -o-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transform-origin: 50% 50%; } .card div { display: block; height: 100%; width: 100%; line-height: 150px; color: white; text-align: center; font-weight: bold; font-size: 140px; position: absolute; -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; -o-backface-visibility: hidden; backface-visibility: hidden; } .card .front { background: #FFE202; } .card .back { background: red; -webkit-transform: rotateY(180deg); -moz-transform: rotateY(180deg); -o-transform: rotateY(180deg); transform: rotateY(180deg); } .flipped { -webkit-transform: rotateY(180deg); -moz-transform: rotateY(180deg); -o-transform: rotateY(180deg); transform: rotateY(180deg); } .card:hover { -webkit-transform: rotateY(180deg); -moz-transform: rotateY(180deg); -o-transform: rotateY(180deg); transform: rotateY(180deg); } .flipped:hover { -webkit-transform: rotateY(-0deg); -moz-transform: rotateY(-0deg); -o-transform: rotateY(-0deg); transform: rotateY(-0deg); } /*Card Flip*/ </style> </head> <body> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <section class="card-container"> <div class="card" id="card1"> <div class="front">K</div> <div class="back">R</div> </div> </section> </body> <script> jQuery(".card").click(function() { var id = jQuery(this).attr('id'); jQuery('#' + id).toggleClass('flipped'); }); </script> </html> |
Wednesday, 9 March 2016
Card Flip In HTML
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment