jquery - how to flip the div using css? -
i trying flip div on hover ..i take example http://css3.bradshawenterprises.com/flip/ still not able flip div on hover ..here fiddle
https://jsfiddle.net/d13cead3/
.front{ width: 100%; height: 100%; background-color:red; } .front:hover { transform: rotatey(180deg); } #container{ perspective: 1000; width:200px; height:200px; } #innercontainer{ width: 100%; height: 100%; transform-style: preserve-3d; transition: 5.0s linear; } .back{ width: 100%; height: 100%; background-color:blue; }
you try using necessary pieces example linked to. updated bit more closely match example:
html:
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>js bin</title> </head> <body> <div class="container"> <div class="innercontainer"> <div class="front face"> front </div> <div class="back face"> </div> </div> </div> </body> </html> css
.container { position: relative; margin: 10px auto; width: 200px; height: 200px; z-index: 1; perspective: 1000; } .innercontainer { width: 100%; height: 100%; transform-style: preserve-3d; transition: 1.0s linear; } .container:hover .innercontainer { transform: rotatey(180deg); box-shadow: -5px 5px 5px #aaa; } .face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; } .face.back { display: block; transform: rotatey(180deg); box-sizing: border-box; padding: 10px; color: white; text-align: center; background-color: #00f; } .face.front{ background-color: #f00; color: #fff; text-align: center; padding: 10px; }
Comments
Post a Comment