-
Notifications
You must be signed in to change notification settings - Fork 0
/
flipcard.html
177 lines (131 loc) · 4.19 KB
/
flipcard.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="css" name="title">
<meta name="author" content="Simone Sacchi">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>flip card</title>
<!-- <link rel="stylesheet" href="css/lib/prism.css" />-->
<link rel="shortcut icon" href="">
<style type="text/css">
body {
padding: 20px;
}
#button {
height: 100px;
width: 100px;
margin: 50px;
}
.container {
display: inline-block;
margin: 20px;
}
/******************************
* FLIP 01
*******************************/
.flip01 {
height: 150px;
width: 150px;
transition: all 500ms ease;
color: white;
font-size: 36px;
}
.container01 {
perspective: 500px;
border: 1px solid black;
}
.card01 {
background-color: red;
}
.transform01 {
/*transform-origin: top left;*/
transform: rotateY(180deg);
}
/******************************
* FLIP 02
*******************************/
.flip02 {
height: 150px;
width: 150px;
transition: all 500ms ease;
color: white;
font-size: 36px;
}
.container02 {
perspective: 500px;
border: 1px solid black;
}
.card02 {
background-color: red;
}
.transform02 {
/* transform-origin: top right;*/
transform-origin: right;
transform: rotateY(180deg);
}
/******************************
* FLIP 03
*******************************/
.flip03 {
height: 150px;
width: 150px;
transition: all 500ms ease;
}
.container03 {
perspective: 500px;
border: 1px solid black;
}
.transformed03 {
/* perspective: 500px;*/
/*transform: rotateY(50deg);*/
transform-style: preserve-3d;
background-color: blue;
}
.child03 {
transform-origin: top left;
/*transform: rotateX(40deg);*/
background-color: lime;
}
.transformed03:hover {
/*blue*/
transform: rotateY(50deg);
}
.child03:hover {
/*lime*/
/*rotateX come accorciare (se non dai perspective anche al container trasformed03)*/
transform: rotateX(180deg);
}
</style>
</head>
<body>
<div class="container">
<div class="flip01 container01">
<div class="flip01 card01" id="card01">FLIP 01 - BASE</div>
</div>
</div>
<div class="container">
<div class="flip02 container02">
<div class="flip02 card02" id="card02">FLIP 02 - OPEN</div>
</div>
</div>
<div class="container">
<div class="flip03 container03">
<div class="flip03 transformed03">
<div class="flip03 child03">FLIP 03 - HOVER</div>
</div>
</div>
</div>
<br>
<button id="button">TOGGLE</button>
<script type="text/javascript">
document.getElementById("button").onclick = function (event) {
document.getElementById("card01").classList.toggle("transform01");
document.getElementById("card02").classList.toggle("transform02");
};
</script>
<!-- <script src="js/lib/prism.js"></script>-->
<script src="js/lib/prefixfree.min.js"></script>
</body>
</html>