-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
96 lines (81 loc) · 2.45 KB
/
demo.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
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WSD官网</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
}
.header {
background-color: rgba(255, 255, 255, 0.353);
/* 调整透明度 */
backdrop-filter: blur(20px);
/* 增加模糊程度 */
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
position: fixed;
top: 0;
left: 0;
width: 100%;
box-sizing: border-box;
z-index: 1000;
}
.logo {
font-size: 24px;
font-weight: bold;
}
.nav {
display: flex;
gap: 20px;
}
.nav a {
text-decoration: none;
color: black;
}
.main {
background-size: cover;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
/* 新增,用于水平居中文本内容 */
}
</style>
<script>
function getRandomImage() {
// 假设这是一个返回随机图片路径的函数
const images = ['1.png', '2.png', '3.png', '4.png', '5.png'];
const randomIndex = Math.floor(Math.random() * images.length);
return images[randomIndex];
}
function changeBackground() {
const mainElement = document.querySelector('.main');
const randomImage = getRandomImage();
mainElement.style.backgroundImage = `url('./images/BackGround/${randomImage}')`;
}
document.addEventListener('DOMContentLoaded', (event) => {
// 初始设置背景图片
changeBackground();
});
</script>
</head>
<body>
<div class="header">
<div class="logo">WSD</div>
<div class="nav">
<a href="/videolink.html">视频链接</a>
<a href="http://www.072211.xyz">导航</a>
<a href="#">关于</a>
</div>
</div>
<div class="main">
<!-- Main content could go here -->
</div>
</body>
</html>