【发布时间】:2016-12-16 23:22:34
【问题描述】:
我有一个使用 Angular 1.5 的应用程序,我正在使用 ngAnimate 和 animate.css 来处理简单的动画。我遇到了一个问题,我需要为子元素设置动画,并且通过 ng-if 将 ng-enter/leave 应用于其父元素。
这是我的标记:
<div class="parent" ng-if="vm.showPanel">
<div class="child animated"> <!--This is the element that need the animation-->
some content
</div>
</div>
这是css:
.parent.ng-enter > div.child{
animation: bounceInRight 1s;
}
.parent.ng-leave > div.child{
animation: bounceOutRight 1s;
}
如果我将动画应用于父元素,它就可以正常工作,但我需要在该子元素中使用它。有什么建议??我知道这一定很简单,但我不确定我错过了什么。在此先感谢各位。
【问题讨论】:
-
@plong0 我试过了,但没有运气:/
标签: javascript css angularjs ng-animate animate.css