我正在尝试在Android OS的Ionic Framework中禁用动画。我试过了:
<body ng-app="myApp" animation="{'no-animation': ionic.Platform.is('android')}">
这不起作用。当我将动画更改为 ng-animation 时,它会添加类&#34; no-animation&#34;导航栏但不禁用动画。有没有办法可以在Ionic Framework中定位特定的操作系统?
答案 0 :(得分:1)
查看Ionic.Platform:http://ionicframework.com/docs/api/utility/ionic.Platform/此外,Cordova的设备插件可以提供帮助。
答案 1 :(得分:0)
我使用了一些vanilla javascript来添加有效的属性。虽然我不确定这是否是正确的方法。以下是添加到index.html文件的代码:
<script>
var noAnimation = ionic.Platform.is('android'),
body = document.getElementById("bd"),
navbar = document.getElementById("nb");
if(noAnimation) {
body.setAttribute('animation', 'no-animation');
navbar.setAttribute('animation', 'no-animation');
}
</script>