Skip to content

Commit 4a91b6a

Browse files
Add animation
1 parent 5ddeefb commit 4a91b6a

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

index.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
<style>
1212
:root {
1313
--primary-color: #3182ce;
14+
--primary-color-rgb: 49, 130, 206;
1415
--secondary-color: #2c5282;
1516
--accent-color: #4299e1;
1617
--text-color: #2d3748;
1718
--bg-color: #f7fafc;
19+
--bg-color-rgb: 247, 250, 252;
1820
--card-bg: #ffffff;
1921
--border-color: #e2e8f0;
2022
--highlight-bg: #fef9f9;
@@ -25,17 +27,32 @@
2527

2628
.dark {
2729
--primary-color: #63b3ed;
30+
--primary-color-rgb: 99, 179, 237;
2831
--secondary-color: #90cdf4;
2932
--accent-color: #4299e1;
3033
--text-color: #e2e8f0;
3134
--bg-color: #1a202c;
35+
--bg-color-rgb: 26, 32, 44;
3236
--card-bg: #2d3748;
3337
--border-color: #4a5568;
3438
--highlight-bg: #3c2a2a;
3539
--highlight-border: #742a2a;
3640
--shadow: 0 4px 15px rgba(0,0,0,0.3);
3741
}
3842

43+
/* 阅读进度条样式 */
44+
.reading-progress-bar {
45+
position: fixed;
46+
top: 0;
47+
left: 0;
48+
height: 4px;
49+
background: linear-gradient(to right, var(--primary-color), var(--accent-color));
50+
width: 0%;
51+
z-index: 9999;
52+
transition: width 0.1s ease;
53+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
54+
}
55+
3956
body {
4057
font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
4158
line-height: 1.8;
@@ -163,6 +180,12 @@
163180
display: flex;
164181
flex-direction: column;
165182
height: 100%;
183+
transition: var(--transition);
184+
}
185+
186+
.task-box:hover {
187+
transform: translateY(-5px);
188+
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
166189
}
167190

168191
.video-question-container {
@@ -174,6 +197,27 @@
174197
.question-section {
175198
margin-top: 1rem;
176199
flex-grow: 1;
200+
transition: var(--transition);
201+
padding: 1rem;
202+
border-radius: 0.5rem;
203+
background-color: rgba(var(--bg-color-rgb, 247, 250, 252), 0.5);
204+
}
205+
206+
.question-section:hover {
207+
background-color: rgba(var(--bg-color-rgb, 247, 250, 252), 0.8);
208+
box-shadow: 0 4px 8px rgba(0,0,0,0.05);
209+
}
210+
211+
.question-section ul li {
212+
transition: var(--transition);
213+
padding: 0.25rem 0.5rem;
214+
border-radius: 0.25rem;
215+
margin-bottom: 0.5rem;
216+
}
217+
218+
.question-section ul li:hover {
219+
background-color: rgba(var(--primary-color-rgb, 49, 130, 206), 0.1);
220+
transform: translateX(5px);
177221
}
178222

179223
.question-container {
@@ -491,6 +535,9 @@
491535
</style>
492536
</head>
493537
<body>
538+
<!-- 阅读进度条 -->
539+
<div class="reading-progress-bar" id="reading-progress"></div>
540+
494541
<!-- 导航栏 -->
495542
<nav class="navbar">
496543
<div class="nav-container">
@@ -785,10 +832,22 @@ <h3 class="subsection-title fade-in">OOD Performance</h3>
785832
checkVisibility();
786833
checkFontAwesome();
787834
enforceTextCenter();
835+
updateReadingProgress();
788836
});
789837

790838
// 滚动时检查可见性
791839
window.addEventListener('scroll', checkVisibility);
840+
841+
// 阅读进度条功能
842+
function updateReadingProgress() {
843+
const progressBar = document.getElementById('reading-progress');
844+
const totalHeight = document.body.scrollHeight - window.innerHeight;
845+
const progress = (window.scrollY / totalHeight) * 100;
846+
progressBar.style.width = `${progress}%`;
847+
}
848+
849+
// 监听滚动事件以更新进度条
850+
window.addEventListener('scroll', updateReadingProgress);
792851
</script>
793852
</body>
794853
</html>

0 commit comments

Comments
 (0)