javascript - ng-animate 不与 ng-show 一起使用

标签 javascript html angularjs ng-animate

我有 ng-animate 在我的 ng-view 上工作;但是,我似乎无法让它为 ng-show 工作。我想淡入 ng-view 内的一个子部分。

这是我的 html:

<section id="content" ng-show="!isSpanish">   
   <item-list page="page" is-spanish="isSpanish" info="info" list="list" api="api" objects="objects"></item-list>
   <item-content page="page" staff="staff" info="info" blog-items="list" list="objects" api="api" overview="filteredOverview" is-spanish="isSpanish" partner="partner"></item-content>
</section>

这是我的 CSS:

#content.ng-hide-add.ng-hide-add-active,
#content.ng-hide-remove.ng-hide-remove-active {
  -webkit-transition: all linear 5s;
  transition: all linear 5s;
}

有什么因素会阻止其正常工作吗?

最佳答案

My Solution in Daniles plunkr

注意:我将其更改为 5s,以便您可以看到隐藏时不透明度为 0 的效果。 nganimate 通过显示将其切换为 1,反之亦然。一旦您看到这一点,您就可以自由更改其他转换属性。

试试这个,在你的CSS下面添加这个:

#content.ng-hide-add.ng-hide-add-active,
#content.ng-hide-remove.ng-hide-remove-active {
   -webkit-transition: all ease-in-out 5s;
   -moz-transition: all ease-in-out 5s;
   -ms-transition: all ease-in-out 5s;
   -o-transition: all ease-in-out 5s;
    transition: all ease-in-out 5s;  
}

#content.ng-hide {     
   line-height: 20px;
   -ms-opacity: 0;
   opacity: 0;
   padding: 0 0px;  
}

关于javascript - ng-animate 不与 ng-show 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29926999/

相关文章:

javascript - 如何检测焦点何时超出 Div?

javascript - IE11 中焦点错误的 activeElement

javascript - 如何在 Angular js 中的同一位置将 HTML 模板替换为另一个模板?

javascript - 在 Javascript 中找到圆与直线的交点

javascript - 我正在研究黑暗模式偏好。 Windows应用程序

javascript - 我想使用 jquery 将类添加到 td 中的 anchor 标记

html - iOS - 在 flexbox 中带有输入元素的 float 光标

javascript - 如何在 DOM 元素的 ng-bind-html 中编译 Angular 表达式 {{scope.somevalue}} ?

javascript - 创建 Jquery 插件

javascript - 在 Javascript 中对字符串内的整数重新编号