-
Notifications
You must be signed in to change notification settings - Fork 4
/
Birthday.html
264 lines (229 loc) · 6.07 KB
/
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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<html>
<head>
<meta name="viewport" content="width=800, initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Nobile:400italic,700italic);
@import url(https://fonts.googleapis.com/css?family=Dancing+Script);
* {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
body {
background: #E5E5E5;
background-image: url("./assets/background.jpg");
padding: 50px;
background-size:cover;
background-repeat:no-repeat;
}
#card-front {
background-image: url("./assets/card.jpeg");
}
#card, #card-front, #card-inside {
height: 480px;
}
.wrap {
padding: 1.5em 2.5em;
height: 100%;
}
#card-front, #card-inside {
width: 60%;
-webkit-box-shadow: 2px 2px 30px rgba(0, 0, 0, .25), 0 0 1px rgba(0, 0, 0, .5);
-moz-box-shadow: 2px 2px 30px rgba(0, 0, 0, .25), 0 0 1px rgba(0, 0, 0, .5);
box-shadow: 2px 2px 30px rgba(0, 0, 0, .25), 0 0 1px rgba(0, 0, 0, .5);
position: absolute;
left: 50%;
}
#card-inside .wrap {
background: #FFEFEF;
-webkit-box-shadow: inset 2px 0 1px rgba(0, 0, 0, .05);
-moz-box-shadow: inset 2px 0 1px rgba(0, 0, 0, .05);
box-shadow: inset 2px 0 1px rgba(0, 0, 0, .05);
}
#card {
max-width: 860px;
margin: 0 auto;
transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
perspective: 5000px;
-moz-perspective: 5000px;
-webkit-perspective: 5000px;
position: relative;
}
#card h1 {
text-align: center;
font-family: 'Nobile', sans-serif;
font-style: italic;
font-size: 70px;
text-shadow:
4px 4px 0px rgba(0, 0, 0, .15),
1px 1px 0 rgba(255, 200, 200, 255),
2px 2px 0 rgba(255, 150, 150, 255),
3px 3px 0 rgba(255, 125, 125, 255);
color: #FFF;
}
#card-inside {
font-size: 1.1em;
line-height: 1.4;
font-family: 'Nobile';
color: #331711;
font-style: italic;
}
p {
margin-top: 1em;
}
p:first-child {
margin-top: 0;
}
p.signed {
margin-top: 1.5em;
text-align: center;
font-family: 'Dancing Script', sans-serif;
font-size: 1.5em;
}
#card-front {
background-color: #FF5555;
background-image: linear-gradient(top, #FF5555 0%, #FF7777 100%);
background-image: -moz-linear-gradient(top, #FF5555 0%, #FF7777 100%);
background-image: -webkit-linear-gradient(top, #FF5555 0%, #FF7777 100%);
transform-origin: left;
-moz-transform-origin: left;
-webkit-transform-origin: left;
transition: transform 1s linear;
-moz-transition: -moz-transform 1s linear;
-webkit-transition: -webkit-transform 1s linear;
position: relative;
}
#card-front .wrap {
transition: background 1s linear;
-moz-transition: background 1s linear;
-webkit-transition: background 1s linear;
}
#card-front button {
position: absolute;
bottom: 1em;
right: -12px;
background: #F44;
color: #FFF;
font-family: 'Nobile', sans-serif;
font-style: italic;
font-weight: bold;
font-size: 1.5em;
padding: .5em;
border: none;
cursor: pointer;
box-shadow: 2px 2px 3px rgba(0, 0, 0, .25), 0 0 1px rgba(0, 0, 0, .4);
-moz-box-shadow: 2px 2px 3px rgba(0, 0, 0, .25), 0 0 1px rgba(0, 0, 0, .4);
-webkit-box-shadow: 2px 2px 3px rgba(0, 0, 0, .25), 0 0 1px rgba(0, 0, 0, .4);
}
#card-front button:hover,
#card-front button:focus {
background: #F22;
}
#close {
display: none;
}
#card.open-fully #close,
#card-open-half #close {
display: inline;
}
#card.open-fully #open {
display: none;
}
#card.open-half #card-front,
#card.close-half #card-front {
transform: rotateY(-90deg);
-moz-transform: rotateY(-90deg);
-webkit-transform: rotateY(-90deg);
}
#card.open-half #card-front .wrap {
background-color: rgba(0, 0, 0, .5);
}
#card.open-fully #card-front,
#card.close-half #card-front {
background: #FFEFEF;
}
#card.open-fully #card-front {
transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-webkit-transform: rotateY(-180deg);
}
#card.open-fully #card-front .wrap {
background-color: rgba(0, 0, 0, 0);
}
#card.open-fully #card-front .wrap *,
#card.close-half #card-front .wrap * {
display: none;
}
footer {
max-width: 500px;
margin: 40px auto;
font-family: 'Nobile', sans-serif;
font-size: 14px;
line-height: 1.6;
color: #888;
text-align: center;
}
</style>
</head>
<body>
<div id="card">
<div id="card-inside">
<div class="wrap">
<p>Dear Anu</p>
<p>“ Happy birthday to you. May this year bring you everything you want.I promise to stay beside you in every ups and downs ."</p>
<p> I want to be the reason of your smile :) </p>
<p>I am lucky to have you .
</p>
<p class="signed">Your's Abhi</p>
</div>
</div>
<div id="card-front">
<div class="wrap">
<h1> Open it with a smile !</h1>
</div>
<button id="open">></button>
<button id="close"><</button>
</div>
</div>
<script>
(function() {
function $(id) {
return document.getElementById(id);
}
var card = $('card'),
openB = $('open'),
closeB = $('close'),
timer = null;
console.log('wat', card);
openB.addEventListener('click', function () {
card.setAttribute('class', 'open-half');
if (timer) clearTimeout(timer);
timer = setTimeout(function () {
card.setAttribute('class', 'open-fully');
timer = null;
var music = document.querySelector("audio");
music.play();
}, 1000);
});
closeB.addEventListener('click', function () {
card.setAttribute('class', 'close-half');
if (timer) clearTimerout(timer);
timer = setTimeout(function () {
card.setAttribute('class', '');
timer = null;
var music = document.querySelector("audio");
music.pause();
}, 1000);
});
}());
</script>
<div style="visibility:hidden">
<audio loop>
<source src="./assets/bday.mp3" type="audio/mpeg">
</audio>
</div>
</body>
</html>