Javascript 在ng enter上设置父元素的动画
我有一个下拉菜单,我想用animate.css的“bounce”类来设置下拉图标的动画,只要有新项目添加到下拉菜单中。我已经安装了ngAnimate模块,并且为li的作品制作了动画。我的问题是,只有当ng enter存在时(即添加了新的列表项),并且只有当ng enter存在时,我才能添加这个css类 代码:Javascript 在ng enter上设置父元素的动画,javascript,css,angularjs,ng-animate,animate.css,Javascript,Css,Angularjs,Ng Animate,Animate.css,我有一个下拉菜单,我想用animate.css的“bounce”类来设置下拉图标的动画,只要有新项目添加到下拉菜单中。我已经安装了ngAnimate模块,并且为li的作品制作了动画。我的问题是,只有当ng enter存在时(即添加了新的列表项),并且只有当ng enter存在时,我才能添加这个css类 代码: 你还需要这方面的帮助吗?是的,我需要,有什么想法吗?我会在几个小时后看一看。这里有一个类似的例子,它似乎有效:你确定你的主模块中包含了portfolioManager.animations
你还需要这方面的帮助吗?是的,我需要,有什么想法吗?我会在几个小时后看一看。这里有一个类似的例子,它似乎有效:你确定你的主模块中包含了
portfolioManager.animations
?是的,我确定。动画在同一目录中的其他视图中工作,但不在此目录中。
<tab class='pull-right' class='ng-isolate-scope'>
<tab-heading>
<div ng-controller="DropdownCtrl">
<!-- Simple dropdown -->
<span class="dropdown" dropdown on-toggle="toggled(open)">
<a href class="dropdown-toggle {{ disableDropdown }} animated" dropdown-toggle ng-click='showMenu = ! showMenu'>
<i class="fa fa-align-justify"></i>
</a>
<ul class="dropdown-menu port-dropdown-menu" ng-show='showMenu && disableDropdown != "disabled"' >
<li class='dropdown-list-item' ng-repeat="choice in dropdown.items">
<a ui-sref="portfolio.manager.edit({portId: choice.id})">{{ choice.title }}</a>
</li>
</ul>
</span>
</div>
</tab-heading>
</tab>
angular.module('portfolioManager.animations', []).animation('.dropdown-list-item', function($timeout) {
return {
enter : function(element, done) {
$('.dropdown-toggle').addClass('bounce');
console.log('add bounce')
$timeout(function() {
$('.dropdown-toggle').removeClass('bounce');
done();
},2000);
}
};
});