Angularjs Animation Card Flip
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 {
Solution 1:
I realize this was a long time ago, but I was just doing this, and it took zero javascript. The key is ng-class. Here is a JSFIDDLE.
The key is this line
<div class="card" ng-class="{'flipped':isFlipped}" ng-click="isFlipped=!isFlipped">
It will assign the class 'flipped' to the card when $scope.isFlipped is true. Here is a little NFL flash cards game I put together for fun. Check out the source code (which isn't super pretty), it should be helpful if you are doing something like this.
Solution 2:
Here is an alternate solution where it's more clear from the html what's happening. Specifically, the flip mechanism is in angularjs rather than buried in css magic. Perhaps easier to follow for anyone who's not a css expert:
<divclass="card"ng-click="isFlipped=!isFlipped"><divclass="face front"ng-class="{'flipped':isFlipped}">
Front
</div><divclass="face back"ng-class="{'flipped':!isFlipped}">
Back
</div></div>
Post a Comment for "Angularjs Animation Card Flip"