-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
114 lines (103 loc) · 3.56 KB
/
Copy pathindex.html
File metadata and controls
114 lines (103 loc) · 3.56 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jiandren</title>
<style>
body {
background-color: #222;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
padding: 0;
}
.daojishi {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
height: 50px;
width: 300px;
text-align: center;
font-size: 28px;
font-family: Microsoft YaHei;
color: #333;
}
.daojishi span {
color: rgb(197, 197, 197);
}
#label {
color: rgb(141, 141, 141);
}
.daojishi p::after {
content: attr(data-spotlight);
color: transparent;
position: absolute;
top: 28px;
left: 52px;
font-size: 28px;
font-family: Microsoft YaHei;
-webkit-clip-path: ellipse(100px 100px at 0% 50%);
clip-path: ellipse(100px 100px at 0% 50%);
animation: spotlight 5s infinite;
background-image: url(https://images.unsplash.com/photo-1579547621869-0ddb5f237392?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=400&q=60);
background-size: 150%;
background-position: center center;
-webkit-background-clip: text;
background-clip: text;
}
@keyframes spotlight {
0% {
-webkit-clip-path: ellipse(100px 100px at 0% 50%);
clip-path: ellipse(100px 100px at 0% 50%);
}
50% {
-webkit-clip-path: ellipse(100px 100px at 100% 50%);
clip-path: ellipse(100px 100px at 100% 50%);
}
100% {
-webkit-clip-path: ellipse(100px 100px at 0% 50%);
clip-path: ellipse(100px 100px at 0% 50%);
}
}
</style>
</head>
<body>
<div class="daojishi">
<p data-spotlight="我们在一起已经">我们在一起已经</p>
<span class="day">1</span> <span id="label">天</span>
<span class="hour">2</span><span id="label">时</span>
<span class="minute">3</span><span id="label">分</span>
<span class="second">4</span><span id="label">秒</span>
</div>
<script>
var day = document.querySelector('.day')
var hour = document.querySelector('.hour'); //小时的
var minute = document.querySelector('.minute'); //分钟的
var second = document.querySelector('.second'); //秒数的
var inputTime = +new Date('2020-01-09 19:30:00');
countDown();
setInterval(countDown, 1000);
function countDown() {
var nowTime = +new Date();
var times = (nowTime-inputTime) / 1000;
var d = parseInt(times / 60 / 60 / 24);
d = d < 10 ? '0' + d : d;
day.innerHTML = d;
var h = parseInt(times / 60 / 60 % 24);
h = h < 10 ? '0' + h : h;
hour.innerHTML = h;
var m = parseInt(times / 60 % 60);
m = m < 10 ? '0' + m : m;
minute.innerHTML = m;
var s = parseInt(times % 60);
s = s < 10 ? '0' + s : s;
second.innerHTML = s;
}
</script>
</body>
</html>
</html>