-
Notifications
You must be signed in to change notification settings - Fork 1
/
transform测试动画.html
111 lines (103 loc) · 2.35 KB
/
transform测试动画.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
html,body{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
img{
display: block;
vertical-align: top;
}
.div1 {
transform: translateX(-100px);
}
.cur .div1 {
transform: translateX(0);
animation: div1 1s;
}
@keyframes div1 {
0% {
transform: translateX(-100px);
}
50% {
transform: translateX(100px);
}
100% {
transform: translateX(0px);
}
}
.div2 {
transform: scale(0.5);
}
.cur.div2 {
transform: scale(1);
animation: div2 1s;
}
@keyframes div2 {
0% {
transform: scale(0.5);
}
50% {
transform: scale(2);
}
100% {
transform: scale(1);
}
}
.div3 {
transform: translateX(-100px);
opacity: 0;
}
.cur .div3 {
opacity: 1;
transform: translateX(0);
transition: all 1s;
}
.div4 {
transform: translateY(-100px);
opacity: 0;
}
.cur.div4 {
opacity: 1;
transform: translateY(0);
transition: all 1s;
}
#add{
position: absolute;
right: 0;
top: 0;
}
#remove{
position: absolute;
right: 0;
top:50px;
}
h1{
padding-top: 200px;
text-align: center;
}
</style>
</head>
<body>
<div class="page page4" style="height: 100%;width: 100%;background-color: pink">
<h1 class="div2">4</h1>
</div>
<button id="add">add</button>
<button id="remove">remove</button>
<script type="text/javascript" src="zepto.js"></script>
<script>
$('#add').on("click",function(){
$('.div2').addClass("cur")
})
$('#remove').on("click",function(){
$('.div2').removeClass('cur')
})
</script>
</body>
</html>