-
Notifications
You must be signed in to change notification settings - Fork 0
/
54-animate插件2-js方式调用.html
45 lines (38 loc) · 1.13 KB
/
54-animate插件2-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
<!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-show="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 {
addClass:function(element,sClass,done){
console.log(sClass);
$(element).animate({width:0,height:0},2000,done);
},
removeClass:function(element,sClass,done){
$(element).css({width:0,height:0});
$(element).animate({width:200,height:200},2000,done);
}
}
});
//定义主页的控制器
m1.controller('indexCtrl',['$scope',function($scope){
$scope.bBtn = true;
}]);
</script>
</body>
</html>