[英]AngularJS ng-show directive showing elements before hiding elements
[英]AngularJs animation for ng-show faster when showing than hiding
我有一个Angular(1.3.14)应用程序(如下所示),当您单击链接时,该应用程序应该为ng-show
动画。 我希望它以相同的速度扩展/收缩,但是我无法使其正常工作。 我也不知道为什么高度更改要等到元素更改不透明度之后才开始。 我希望它们同时发生。 有任何想法吗?
这是我遇到的问题的一个示例: https : //jsfiddle.net/0wcrcwxe/
angular.module("app", ["ngAnimate"]) .controller("WebController", ["$scope", "$q", "$timeout", function($scope, $q, $timeout) { this.checked = true; }]);
.animate-show { max-height:9999px !important; opacity: 1; overflow:hidden; } .animate-show.ng-hide-add.ng-hide-add-active, .animate-show.ng-hide-remove.ng-hide-remove-active { transition:all ease 3.35s; } .animate-show.ng-hide { max-height:0 !important; opacity:0; }
<!DOCTYPE html> <html lang="en" data-ng-app="app"> <head> <title>Example</title> </head> <body data-ng-controller="WebController as ctrl"> <div> <a href="#" data-ng-click="ctrl.checked = !ctrl.checked">Click to show / hide</a> <div class="animate-show" data-ng-show="ctrl.checked"> I show up all the time<br/> I show up all the time<br/> I show up all the time<br/> I show up all the time<br/> I show up all the time<br/> I show up all the time<br/> I show up all the time<br/> </div> </div> End <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-animate.js"></script> </body> </html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.