firefox - Angular 2 动画/过渡仅适用于 chrome?

标签 firefox animation angular cross-browser transition

正如标题所说,我一直在使用 Angular2 构建网络应用程序,并决定测试跨浏览器,结果发现漂亮的动画只能在 Chrome 中运行。这是我的一个组件的样子,如果这可能会有所不同的话:

@Component({
  selector: 'contact',
  templateUrl: 'app/about.component.html',
  styleUrls: ['app/about.component.css'],
  
  host: {
     '[@routeAnimation]': 'true',
     '[style.position]': "'absolute'",
     '[style.margin]':"'auto'",
     '[style.text-align]':"'center'",
     '[style.width]':"'100%'",
     '[style.display]':"'block'"

     
    
   },
  animations: [
    trigger('routeAnimation', [
      state('*', style({transform:            'translateX(0)', opacity: 1})),
      transition('void => *', [
        style({transform: 'translateX(100%)',   opacity: 0}),
        animate(500)
      ]),
      transition('* => void', animate(500, style({transform: 'translateX(100%)', opacity: 0})))
    ])
  ],
	  
})

我可能遗漏了什么/我可以尝试实现什么以获得跨浏览器功能?

谢谢

最佳答案

来自 ' https://angular.io/docs/ts/latest/guide/animations.html ':

Angular animations are built on top of the standard Web Animations API and they run natively on browsers that support it.

Web Animation API 目前没有得到很好的支持。请查收:http://caniuse.com/#feat=web-animation

您需要使用 polyfill 来使动画正常工作。这个https://github.com/web-animations/web-animations-js可以使用。

关于firefox - Angular 2 动画/过渡仅适用于 chrome?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39168689/

相关文章:

html - 如何在 Firefox ContentEditable 中强制 <br> 换行

python - 在 Mac 上使用 Python 控制浏览器

javascript - 强制 firefox 在 img.src 更改后重新加载图像

android - 通过线性布局移动图像

ios - 为某些元素设置动画时 UIView 会排除其他元素

ios - 如何在 SwiftUI 中动画/过渡文本值更改

Angular 4获取dom元素

angularjs - $scope 没有提供者!在 Angular 2 应用程序中使用 Angular 1 指令时出错

html - Textarea 标签在 Firefox 中生成两行而不是一行,但在 Chrome 中效果很好

Angular Material 提交按钮不起作用