【发布时间】:2014-12-12 15:22:14
【问题描述】:
我正在尝试为 ng-show 创建淡入淡出功能。我读过很多帖子,但似乎他们使用的是旧的 Angular 版本。
我有类似的东西
<button ng-click="play()"></button>
<div id='wrapper' ng-show="animate"
ng-animate="{show:'animate-show', hide:'animate-hide'}">
TEST HERE</div>
JS
$scope.animate = false;
$scope.play = function() {
$scope.animate = true;
}
CSS
.animate-show, .animate-hide {
-webkit-transition:all linear 1s;
-moz-transition:all linear 1s;
-ms-transition:all linear 1s;
-o-transition:all linear 1s;
transition:all linear 1s;
}
.animate-show {
opacity:0;
}
.animate-show.animate-show-active {
opacity:1;
}
.animate-hide {
opacity:1;
}
.animate-hide.animate-hide-active {
opacity:0;
}
以上代码只显示和隐藏元素,不提供动画。有谁知道如何制作动画?谢谢!
【问题讨论】: