14

I am trying to use the new AngularJS way of doing animations between page transitions and would like to incorporate a card flip (like http://jsfiddle.net/nicooprat/GDdtS/)

body {
 background: #ccc;   
}
.flip {
-webkit-perspective: 800;
width: 400px;
height: 200px;
position: relative;
margin: 50px auto;
}
.flip .card.flipped {
-webkit-transform: rotatex(-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: black;
 color: white;
 cursor: pointer;
}
.flip .card .back {
 -webkit-transform: rotatex(-180deg);
  background: blue;
  background: white;
  color: black;
  cursor: pointer;
}

I am just a bit unsure how to update that code to make it work with AngularJS for a page transition.

Any thoughts?

4

2 に答える 2

28

これはずっと前のことだと思いますが、私はちょうどこれを行っていたので、javascript は必要ありませんでした。キーはngクラスです。ここにJSFIDDLEがあります。

キーはこの行です

<div class="card" ng-class="{'flipped':isFlipped}" ng-click="isFlipped=!isFlipped"> 

$scope.isFlipped が true の場合、「反転」クラスをカードに割り当てます。これは、私が楽しみのためにまとめた小さな NFL フラッシュ カード ゲームです。ソース コードを確認してください (あまりきれいではありません)。このようなことをしている場合に役立つはずです。

NFL フラッシュ カード

于 2014-04-28T00:53:31.603 に答える