2014-09-23 46 views
2

我想禁用Android OS的離子框架中的動畫。我曾嘗試過:離子框架:取決於操作系統的條件動畫

<body ng-app="myApp" animation="{'no-animation': ionic.Platform.is('android')}"> 

這是行不通的。當我將動畫改爲ng-animation時,它將類「no-animation」添加到導航欄中,但不禁用動畫。有什麼辦法可以針對Ionic Framework中的特定操作系統?

回答

0

我用一些香草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> 
相關問題