24大数据技术6.11实验课作业

注意

把图片文件在资料-images需要解压然后放到和你代码同目录的位置
点击代码块,可使用方向键左右移动查看代码
代码块右上角可以最小化代码
注释部分不需要敲

1.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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>三角洲行动</title>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: "Microsoft YaHei", sans-serif;
color: #e2e8f0;
background: #0f172a;
line-height: 1.6;
padding-top: 100vh;
}

/* ============ 导航栏(flex) ============ */
.nav {
display: flex;
align-items: center;
background: #1e293b;
padding: 0 32px;
height: 64px;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 10;
border-bottom: 1px solid #334155;
}
.logo {
width: 44px;
height: 44px;
border-radius: 8px;
background: #f97316;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-weight: 800;
font-size: 1.2rem;
cursor: pointer;
transition: transform 0.3s;
}
.separator { width: 1px; height: 28px; background: #334155; margin: 0 20px; }
.nav-box { display: flex; gap: 8px; flex: 1; }
.nav-box a {
color: #cbd5e1;
text-decoration: none;
padding: 8px 16px;
border-radius: 8px;
font-size: 0.95rem;
transition: all 0.2s;
}
.nav-box a:hover { background: #f97316; color: #fff; }
.login {
background: #f97316;
color: #fff;
padding: 8px 20px;
border-radius: 6px;
text-decoration: none;
font-size: 0.9rem;
font-weight: 600;
border: none;
cursor: pointer;
}
.login:hover { background: #ea580c; }

/* ============ 大图 ============ */
.hero {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background-image: url('images/delta/1.jpg');
background-size: cover;
background-position: center;
z-index: 0;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
text-align: center;
}
.hero::before {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(135deg, rgba(15,23,42,0.6), rgba(127,29,29,0.4));
}
.hero-content { position: relative; z-index: 1; }
.hero h1 {
font-size: 5rem;
font-weight: 900;
letter-spacing: 0.3rem;
text-shadow: 0 4px 20px rgba(0,0,0,0.6);
margin-bottom: 12px;
}
.hero p { font-size: 1.3rem; }

/* ============ 网格展示区 ============ */
.section {
position: relative;
z-index: 1;
max-width: 1200px;
margin: 0 auto;
padding: 60px 24px;
}
.section h2 {
text-align: center;
font-size: 1.8rem;
margin-bottom: 40px;
color: #f1f5f9;
}
.section h2::after {
content: "";
display: block;
width: 60px;
height: 3px;
background: #f97316;
margin: 12px auto 0;
}
.grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}
.card {
background: #1e293b;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
border: 1px solid #334155;
transition: all 0.3s;
}
.card:hover {
transform: translateY(-8px);
border-color: #f97316;
}
/* jQuery 添加的高亮状态 */
.card.active {
border-color: #fbbf24;
box-shadow: 0 0 20px rgba(251,191,36,0.5);
transform: translateY(-8px);
}

/* 卡片选中时图片变亮 */
.card.active img {
filter: brightness(1.2);
}
.card img {
width: 100%;
height: 200px;
object-fit: cover;
display: block;
}
.card-body { padding: 16px; text-align: center; }
.card-body h3 { font-size: 1.05rem; margin-bottom: 4px; color: #f1f5f9; }
.card-body p { font-size: 0.85rem; color: #94a3b8; }

/* ============ 提示条 ============ */
.toast {
position: fixed;
top: 80px;
right: 20px;
background: #f97316;
color: #fff;
padding: 12px 24px;
border-radius: 8px;
font-weight: 600;
z-index: 100;
display: none;
}

/* ============ 页脚 ============ */
.footer {
position: relative;
z-index: 1;
background: #020617;
color: #64748b;
text-align: center;
padding: 24px;
border-top: 1px solid #1e293b;
}
.footer a { color: #f97316; text-decoration: none; }
</style>
</head>
<body>
<nav class="nav">
<div class="logo">Δ</div>
<div class="separator"></div>
<div class="nav-box">
<a href="#hero">首页</a>
<a href="#ops">干员</a>
<a href="#maps">地图</a>
<a href="#footer">关于</a>
</div>
<button class="login" id="loginBtn">登录账号</button>
</nav>

<div class="hero" id="hero">
<div class="hero-content">
<h1>三角洲行动</h1>
<p>特种干员 · 战术射击</p>
</div>
</div>

<div class="toast" id="toast">提示文字</div>

<!-- 干员 -->
<div class="section" id="ops">
<h2>干员展示</h2>
<div class="grid">
<div class="card" data-name="红狼">
<img src="images/delta/op1.jpg">
<div class="card-body"><h3>红狼</h3><p>突击干员 · GTI</p></div>
</div>
<div class="card" data-name="牧羊人">
<img src="images/delta/op2.jpg">
<div class="card-body"><h3>牧羊人</h3><p>工程干员 · GTI</p></div>
</div>
<div class="card" data-name="露娜">
<img src="images/delta/op3.jpg">
<div class="card-body"><h3>露娜</h3><p>侦察干员 · GTI</p></div>
</div>
<div class="card" data-name="蜂医">
<img src="images/delta/op4.jpg">
<div class="card-body"><h3>蜂医</h3><p>支援干员 · GTI</p></div>
</div>
</div>
</div>

<!-- 地图 -->
<div class="section" id="maps">
<h2>地图模式</h2>
<div class="grid">
<div class="card" data-map="源工重镇">
<img src="images/delta/map1.jpg">
<div class="card-body"><h3>源工重镇</h3><p>大型攻防地图</p></div>
</div>
<div class="card" data-map="隐世修所">
<img src="images/delta/map2.jpg">
<div class="card-body"><h3>隐世修所</h3><p>秘密潜入任务</p></div>
</div>
<div class="card" data-map="霓虹町">
<img src="images/delta/map3.jpg">
<div class="card-body"><h3>霓虹町</h3><p>都市激战</p></div>
</div>
<div class="card" data-map="亚海悬城">
<img src="images/delta/map4.jpg">
<div class="card-body"><h3>亚海悬城</h3><p>海岛行动</p></div>
</div>
</div>
</div>

<div class="footer" id="footer">
<p>© 三角洲行动 · (你的名字) <a href="#hero">返回顶部</a></p>
</div>

<!-- jQuery 交互 -->
<script>
$(function () {

// 1. 导航栏点击平滑滚动到对应区域
$('.nav-box a').click(function (e) {
e.preventDefault();
var target = $(this).attr('href');
$('html, body').animate({
scrollTop: $(target).offset().top - 64
}, 500);
});

// 2. 点击干员卡片 → 高亮 + 提示
$('#ops .card').click(function () {
$('#ops .card').removeClass('active');
$(this).addClass('active');
showToast('已选择干员:' + $(this).data('name'));
});

// 3. 双击干员卡片 → 取消选中
$('#ops .card').dblclick(function () {
$(this).removeClass('active');
showToast('已取消选择');
});

// 4. 点击地图卡片 → 显示地图名
$('#maps .card').click(function () {
showToast('地图:' + $(this).data('map'));
});

// 5. 登录按钮 → 累计点击次数 + 改变文字
var count = 0;
$('#loginBtn').click(function () {
count++;
$(this).text(count > 1 ? '已登录 (' + count + ')' : '登录账号');
showToast('登录点击次数:' + count);
});

// 6. 点击 logo → 随机旋转
$('.logo').click(function () {
$(this).css('transform', 'rotate(' + Math.floor(Math.random() * 720) + 'deg)');
});

// 7. 鼠标悬停干员卡片 → 边框变色
$('#ops .card').hover(
function () { $(this).css('border-color', '#dc2626'); },
function () { $(this).css('border-color', ''); }
);

// 8. 统计卡片总数并显示在标题
var opCount = $('#ops .card').length;
var mapCount = $('#maps .card').length;
$('#ops h2').text('干员展示(共 ' + opCount + ' 位)');
$('#maps h2').text('地图模式(共 ' + mapCount + ' 张)');

// 通用提示函数
function showToast(text) {
$('#toast').text(text).fadeIn(200).delay(1200).fadeOut(200);
}
});
</script>
</body>
</html>