-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
254 lines (223 loc) · 6.24 KB
/
index.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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<meta name="color-scheme" content="dark" />
<link rel="icon" type="image/svg+xml" href="./favicon.svg" sizes="any" />
<title>舷窗</title>
<style>
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
background-color: #18202b;
}
.root {
position: relative;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.root::before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-image: url("./assets/noise.png");
background-repeat: repeat;
opacity: 0.04;
pointer-events: none;
user-select: none;
}
.main {
position: relative;
height: 90vh;
border-radius: 6%;
overflow: hidden;
outline: 1px solid #5a6275;
}
.main img {
position: relative;
z-index: 99;
height: 100%;
user-select: none;
pointer-events: none;
}
.main .video {
position: absolute;
top: 0;
bottom: 0;
left: 50%;
width: 100%;
height: 100%;
padding: 28% 0 25% 0;
transform: translateX(-50%);
}
.main .video video {
height: 100%;
}
.popup {
position: absolute;
top: 0;
bottom: 0;
right: 0;
z-index: 999;
width: 450px;
overflow-y: auto;
backdrop-filter: blur(30px) saturate(120%);
border-left: 1px solid #5a6275;
display: none;
}
.popup.show {
display: flex;
flex-direction: column;
}
.vistas {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: auto;
gap: 20px;
max-height: 100%;
padding: 20px;
overflow-y: auto;
}
.vistas .item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #fff;
}
.vistas img {
width: 100%;
border-radius: 5%;
}
.vistas img ~ span {
margin-top: 10px;
}
button {
cursor: pointer;
}
#select {
position: absolute;
top: 20px;
right: 20px;
z-index: 99;
}
@media screen and (max-width: 930px) {
.root {
display: flex;
flex-direction: column;
}
.main {
width: 100%;
height: auto;
outline: none;
border-radius: 0;
}
.main img {
width: 100%;
height: auto;
}
.popup {
width: 100vw;
}
.vistas {
flex-direction: row;
flex-wrap: wrap;
padding: 30px;
font-size: 12px;
}
}
</style>
</head>
<body>
<div class="root">
<button id="select">选择风景</button>
<div class="main">
<img src="./assets/porthole.png" />
<div class="video">
<video id="video" autoplay loop muted>
<source src="./assets/巴塔哥尼亚的高山.mp4" type="video/mp4" />
</video>
</div>
</div>
<div class="popup">
<div style="padding: 20px 20px 10px 20px">
<button id="close-btn">关闭</button>
</div>
<div style="flex: 1; overflow: hidden">
<div class="vistas">
<div class="item" data-src="巴塔哥尼亚的高山">
<img src="./assets/巴塔哥尼亚的高山.jpg" />
<span>巴塔哥尼亚的高山</span>
</div>
<div class="item" data-src="巴塔哥尼亚湖">
<img src="./assets/巴塔哥尼亚湖.jpg" />
<span>巴塔哥尼亚湖</span>
</div>
<div class="item" data-src="格陵兰大冰川">
<img src="./assets/格陵兰大冰川.jpg" />
<span>格陵兰大冰川</span>
</div>
<div class="item" data-src="加勒比">
<img src="./assets/加勒比.jpg" />
<span>加勒比</span>
</div>
<div class="item" data-src="迪拜城市轮廓线">
<img src="./assets/迪拜城市轮廓线.jpg" />
<span>迪拜城市轮廓线</span>
</div>
<div class="item" data-src="伦敦城市轮廓线">
<img src="./assets/伦敦城市轮廓线.jpg" />
<span>伦敦城市轮廓线</span>
</div>
<div class="item" data-src="纽约中城区">
<img src="./assets/纽约中城区.jpg" />
<span>纽约中城区</span>
</div>
<div class="item" data-src="大峡谷沉积物">
<img src="./assets/大峡谷沉积物.jpg" />
<span>大峡谷沉积物</span>
</div>
<div class="item" data-src="杰克鱼群">
<img src="./assets/杰克鱼群.jpg" />
<span>杰克鱼群</span>
</div>
<div class="item" data-src="梭鱼群">
<img src="./assets/梭鱼群.jpg" />
<span>梭鱼群</span>
</div>
</div>
</div>
</div>
</div>
<script>
const video = document.querySelector("#video");
const popup = document.querySelector(".popup");
document.querySelector("#select").addEventListener("click", () => {
popup.classList.add("show");
});
document.querySelector("#close-btn").addEventListener("click", () => {
popup.classList.remove("show");
});
const items = document.querySelectorAll(".vistas .item");
items.forEach((item) => {
item.addEventListener("click", (ev) => {
video.src = `./assets/${ev.currentTarget.dataset.src}.mp4`;
video.load();
});
});
</script>
</body>
</html>