這是我的代碼,如果可能的話,請看看。沒有官方的,我只是把這個代碼放在一邊以便以後使用。Angularjs動畫無法正常工作,我碰到了一個死樹
<script>
\t var apps = angular.module('myApp', ['ngAnimate']);
\t
\t //header
\t apps.controller('headerCtrl', function($scope) {
\t $scope.header = "Animating with AngularJS and";
\t \t $scope.headerCode= "CSS3"
\t });
\t
\t //footer
\t apps.controller('footerCtrl', function($scope) {
\t $scope.footerItems = ['Footer Item 1', 'Footer Item 2', 'Footer Item 3'];
\t });
\t
\t //animate hide/show
\t apps.controller('animateCtrl', function($scope) {
\t $scope.testText = "This is just to test the animation effect!!";
\t \t $scope.toggleBox = false;
\t \t $scope.Toggle = function() {
\t \t $scope.toggleBox = !$scope.toggleBox;
\t \t }
\t });
\t
\t </script>
.hideShow.ng-enter,
\t {
\t transition: 0.5s linear all ;
\t -moz-transition: 0.5s linear all;
\t -webkit-transition: 0.5s linear all ;
\t opacity:0;
\t
\t }
\t
\t .hideShow.ng-enter.ng-enter-active
\t {
\t opacity:1;
\t }
\t
\t .hideShow.ng-leave
\t {
\t transition: 0.25s linear all ;
\t -moz-transition: 0.25s linear all;
\t -webkit-transition: 0.25s linear all ;
\t opacity:0;
\t }
\t
\t .hideShow.ng-leave.ng-leave-active
\t {
\t opacity:0;
\t }
<div class="container-fluid" ng-app="myApp">
\t
\t \t <header ng-controller="headerCtrl">
\t \t \t <div class="jumbotron page-header">
\t \t \t \t <h1>{{header}} <kbd>{{headerCode}}</kbd></h1>
\t \t \t </div>
\t \t </header>
\t \t
\t \t
\t \t <!--MAIN CONTENT (animate)-->
\t \t
\t <div class="jumbotron" ng-controller="animateCtrl">
\t \t \t <button class="btn btn-primary" ng-click="Toggle()">TOGGLE</button>
\t \t \t <div class="hideShow" ng-show="toggleBox"><h2>{{testText}}</h2></div>
\t \t
\t \t </div>
\t
\t <!-- FOOTER -->
\t <div class="navbar navbar-inverse navbar-fixed-bottom" ng-controller="footerCtrl">
\t \t <footer>
\t \t \t <ul class="nav navbar-nav">
\t \t \t \t <li class="navbar-brand" ng-repeat="footerItem in footerItems"> {{footerItem}} </li>
\t \t \t </ul>
\t \t \t </footer>
\t </div>
\t
\t
</div>
的切換工作正常,但我想一切可能的方式獲得動畫沒有成功的工作。有人可以幫我一把嗎?非常感謝!
你能爲此做一個快速蹲點或其他東西嗎?這將是更容易測試/修復它 – ribsies 2015-02-05 17:10:20
你走了 - 這是一個闖入===>:[鏈接](http://plnkr.co/edit/TpWMLElJmOZ0oExw0uB8?p=preview) – 2015-02-05 17:13:15