-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path53-animate插件-js方式调用.html
50 lines (41 loc) · 1.27 KB
/
53-animate插件-js方式调用.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>event传播</title>
<style>
.box{width:200px;height:200px; border:1px solid red; background: blue;}
</style>
</head>
<body>
<div ng-controller="indexCtrl" id="parent" >
<input type="checkbox" ng-model="bBtn">
<div ng-if="bBtn" class="box">test</div>
</div>
<script type="text/javascript" src="js/angular.min.js" ></script>
<script type="text/javascript" src="js/angular-animate.min.js" ></script>
<script type="text/javascript" src="js/jquery203.js" ></script>
<script>
var m1 = angular.module('myApp',['ngAnimate']);
m1.animation('.box',function(){
return {
leave:function(element,done){
//console.log(element);//我们要控制的元素
//console.log(done);//函数
$(element).animate({width:0,height:0},2000,done);
},
enter:function(element,done){
//console.log(element);//我们要控制的元素
//console.log(done);//函数
//设置初始值
$(element).css({width:0,height:0});
$(element).animate({width:200,height:200},2000,done);
}
}
});
//定义主页的控制器
m1.controller('indexCtrl',['$scope',function($scope){
}]);
</script>
</body>
</html>