我使用的是ngAnimate模块,但我所有的ng-if
、ng-show
等都受此影响,我想对一些选定的元素使用ngAnimate。对于性能和元素中的一些错误,显示和隐藏速度非常快。
谢谢。
发布于 2015-06-20 04:54:17
只需将其添加到您的CSS。最好是最后一条规则:
.no-animate {
-webkit-transition: none !important;
transition: none !important;
}
然后将no-animate
添加到要禁用的元素的类中。示例:
<div class="no-animate"></div>
发布于 2014-07-03 06:31:14
如果希望为特定元素启用动画(而不是对特定元素禁用动画),则可以使用$animateProvider配置具有特定类名(或正则表达式)的元素进行动画。
下面的代码将为具有angular-animate
类的元素启用动画:
var myApp = angular.module("MyApp", ["ngAnimate"]);
myApp.config(function($animateProvider) {
$animateProvider.classNameFilter(/angular-animate/);
})
下面是包含启用动画的angular-animate
类的示例标记:
<div ng-init="items=[1,2,3,4,5,6,7,8,9]">
<input placeholder="Filter with animations." ng-model="f" />
<div class="my-repeat-animation angular-animate" ng-repeat="item in items | filter:f track by item" >
{{item}}
</div>
</div>
从this blog借用和修改的Plunker示例,其中只有第一个过滤器具有动画(由于具有angular-animate
类)。
请注意,我使用angular-animate
作为示例,并且可以使用.classNameFilter
函数对其进行完全配置。
发布于 2017-12-06 02:17:43
我知道这是延迟回复,但我们在MainController中使用:
// disable all animations
$animate.enabled(false);
但问题是,当我们禁用所有动画时,ui-select被配置为opacity: 0
。
因此,有必要使用CSS将不透明度设置为1:
.ui-select-choices {
opacity: 1 !important;
}
这将正确设置不透明度,并且ui-select将起作用。
https://stackoverflow.com/questions/21249441
复制相似问题