防止 angularjs 动画在加载时最初隐藏的元素上运行 [英] Prevent angularjs animation from running on element that is initially hidden when loaded

查看:20
本文介绍了防止 angularjs 动画在加载时最初隐藏的元素上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆