首页 > 代码库 > css3 3d正反面翻转
css3 3d正反面翻转
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> .flip-container { perspective: 1000; } /* flip the pane when hovered */ /*.flip-container:hover .flipper, .flip-container.hover .flipper { transform: rotateY(180deg); }*/ .flip-container.hover .flipper { transform: rotateY(180deg); } .flip-container, .front, .back { width: 320px; height: 480px; } /* flip speed goes here */ .flipper { transition: 0.6s; transform-style: preserve-3d; position: relative; } /* hide back of pane during swap */ .front, .back { backface-visibility: hidden; position: absolute; top: 0; left: 0; } /* front pane, placed above back */ .front { z-index: 2; background: red; } /* back, initially hidden pane */ .back { transform: rotateY(180deg); background: cyan; } #myCard { padding-top:300px; } </style> </head> <body> <!-- <div class="flip-container" ontouchstart="this.classList.toggle(‘hover‘);"> --> <div class="flip-container"> <div class="flipper"> <div class="front"> 前面内容 </div> <div class="back"> 背面内容 </div> </div> </div> <!-- /<div id="myCard" onclick="document.querySelector(‘.flip-container‘).classList.toggle(‘hover‘)">but</div> --> <div id="myCard">but</div> <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script> <script> $(function(){ $(‘#myCard‘).click(function(){ $(‘.flip-container‘).toggleClass(‘hover‘) }) }) </script> </body> </html>
原文:http://www.jianshu.com/p/99aeb911f547;
https://segmentfault.com/a/1190000003903190
css3 3d正反面翻转
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。