防止 angularjs 动画在加载时最初隐藏的元素上运行 [英] Prevent angularjs animation from running on element that is initially hidden when loaded
问题描述
http://codepen.io/cflynn07/pen/hbgxf
^ 例子
我有一个 angularjs 动画,我不希望它在应该隐藏的元素的页面加载时运行.
I have an angularjs animation, and I don't want it to run on page load for an element that is supposed to be hidden.
现在,显示元素,然后出现向上滑动动画并隐藏元素.
Right now, the element is shown, then the slide up animation occurs and hides the element.
推荐答案
这是您要找的吗?
http://codepen.io/anon/pen/JaHKL
基本上你需要设置 style="display: none;"
来声明初始状态.
Basically you need set style="display: none;"
to declare the initial state.
否则初始状态将是 display:inline
并且当 AngularJS 读取 data-ng-show="false"
时,它会触发你的 hide代码> 动画以匹配您的设置.
Otherwise the initial state will be display:inline
and when AngularJS reads data-ng-show="false"
, it will trigger your hide
animation in order to match your setting.
希望有帮助.
这篇关于防止 angularjs 动画在加载时最初隐藏的元素上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!