Prevent angularjs animation from running on element that is initially hidden when loaded [duplicate]

与世无争的帅哥 提交于 2019-12-11 01:22:10

问题


http://codepen.io/cflynn07/pen/hbgxf
^ Example

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.


回答1:


Is this something you're looking for?

http://codepen.io/anon/pen/JaHKL

Basically you need set style="display: none;" to declare the initial state.

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.

Hope it helps.



来源:https://stackoverflow.com/questions/16158021/prevent-angularjs-animation-from-running-on-element-that-is-initially-hidden-whe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!