Angular.js动画不起作用
Angular.js animation not working
我用HTML 写了一个小代码
<html ng-app="myApp">
<head>
<script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js' ></script>
<script src='//ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular-animate.js' /></script>
<script src='./hello.js' ></script>
<style>
.sample-show-hide {
padding:10px;
border:1px solid black;
background:white;
}
.sample-show-hide {
-webkit-transition:all linear 3s;
transition:all linear 3s;
}
.sample-show-hide.ng-hide {
opacity:0;
}
</style>
</head>
<body ng-controller='Sample'>
<div class='sample-show-hide' style='z-index:2;' ng-init='timeout=false;' ng-hide='timeout'> Unable to get location </div>
</body>
</html>
其中hello.js代码是
var myApp = angular.module('myApp',[]);
myApp.controller('Sample',function($timeout,$scope){
console.log('coming here');
$timeout(function(){
console.log('coming here again');
$scope.timeout=true;
},2000);
});
但在我的代码中,动画不起作用。有人能告诉我为什么不起作用吗??
var myApp = angular.module('myApp',["ngAnimate"]);
试试这个代码:)
相关文章:
- JQuery动画延长容器不起作用
- 滚动动画代码不起作用
- -webkit转换在JavaScript旋转动画中不起作用(没有JQuery)
- firefox中的CSS动画不起作用
- jQuery切换方法的动画不起作用
- 悬停不起作用时对不透明度更改进行动画处理
- j查询动画重置后事件不起作用
- 对链接的 svg 进行动画处理不起作用;内联时工作正常
- 使用动画时Jquery后退按钮不起作用
- 动画代码没有'不起作用
- SVG元素的动态动画在IE中不起作用
- 传单.markrcluster:动画不起作用
- jquery UI添加带有动画的类;不起作用
- ng重复's动画;在同一元素上使用ngInclude时不起作用
- Iframe加载动画不起作用
- HTML5-逐帧动画不起作用
- Javascript图像动画在Firefox或Internet Explorer中不起作用
- 翻转动画在Firefox上不起作用
- 输入文本的动画在firefox中不起作用
- Javascript动画不起作用