-
Notifications
You must be signed in to change notification settings - Fork 0
/
happy-birthday.html
112 lines (98 loc) · 2.82 KB
/
happy-birthday.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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="initial-scale=1">
<title>happy birthday!</title>
<style>
body {
background: #39D;
}
.circular-menu {
width: 250px;
height: 250px;
margin: 0 auto;
position: relative;
top: 200px;
}
.circle {
width: 250px;
height: 250px;
opacity: 0;
-webkit-transform: scale(0);
-moz-transform: scale(0);
transform: scale(0);
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
}
.open.circle {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
transform: scale(1);
}
.circle a {
text-decoration: none;
color: white;
display: block;
height: 40px;
width: 40px;
line-height: 40px;
margin-left: -20px;
margin-top: -20px;
position: absolute;
text-align: center;
font-size: 25px;
}
.circle a:hover {
color: #eef;
}
.menu-button {
position: absolute;
top: 50%;
left: 50%;
margin-top: -35px;
margin-left: -35px;
text-decoration: none;
text-align: center;
color: #39D !important;
border-radius: 50%;
display: block;
height: 50px;
width: 50px;
line-height: 50px;
padding: 10px;
background: #dde;
font-size: 16px;
}
.menu-button:hover {
background-color: #eef;
}
</style>
</head>
<body>
<nav class="circular-menu">
<div class="circle">
<a href="">祝</a>
<a href="">你</a>
<a href="">生</a>
<a href="">日</a>
<a href="">快</a>
<a href="">乐</a>
</div>
<a href="" class="menu-button">touch!</a>
</nav>
<script>
var items = document.querySelectorAll('.circle a');
for(var i = 0, l = items.length; i < l; i++) {
items[i].style.left = (50 - 35*Math.cos(0.5 * Math.PI + 2*(1/l)*i*Math.PI)).toFixed(4) + "%";
items[i].style.top = (50 - 35*Math.sin(0.5 * Math.PI + 2*(1/l)*i*Math.PI)).toFixed(4) + "%";
}
document.querySelector('.menu-button').onclick = function(e) {
e.preventDefault(); document.querySelector('.circle').classList.toggle('open');
}
</script>
</body>
</html>