Skip to content

Commit 48a6666

Browse files
fix: Tab 内容显示 + 进度条移至底部
1 parent cb320a8 commit 48a6666

1 file changed

Lines changed: 45 additions & 22 deletions

File tree

docs/index.html

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<meta name="description" content="Python IDE - 掌上的 Python & JavaScript 开发环境" />
77
<title>Python IDE - 掌上的 Python & JavaScript 开发环境</title>
8-
<link rel="icon" type="image/png" href="icon.png" />
8+
<link rel="icon" type="image/png" href="favicon.png" sizes="32x32" />
9+
<link rel="icon" type="image/png" href="icon.png" sizes="192x192" />
910
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"></script>
1011
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/ScrollTrigger.min.js"></script>
1112
<style>
@@ -51,18 +52,6 @@
5152
overflow-x: hidden;
5253
}
5354

54-
/* Scroll progress - 底部阅读进度,避免被误认为加载条 */
55-
#scroll-progress {
56-
position: fixed;
57-
bottom: 0; left: 0;
58-
height: 2px;
59-
width: 0%;
60-
background: linear-gradient(90deg, var(--border) 0%, var(--text-muted) 100%);
61-
z-index: 9999;
62-
transition: width 0.1s ease-out;
63-
opacity: 0.7;
64-
}
65-
6655
/* Lang switcher - no glass bar */
6756
.lang-switcher {
6857
position: fixed;
@@ -539,6 +528,37 @@
539528
.screenshot-item p { color: #fff; }
540529
.why-item .check { background: linear-gradient(135deg, #424a53, #656d76); color: #fff; }
541530
}
531+
/* 回顶部按钮 */
532+
.back-to-top {
533+
position: fixed;
534+
bottom: 1.5rem;
535+
right: 1.5rem;
536+
width: 48px;
537+
height: 48px;
538+
border-radius: 50%;
539+
background: var(--card);
540+
border: 1px solid var(--border);
541+
color: var(--text-muted);
542+
display: flex;
543+
align-items: center;
544+
justify-content: center;
545+
cursor: pointer;
546+
z-index: 90;
547+
opacity: 0;
548+
visibility: hidden;
549+
transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
550+
box-shadow: 0 4px 20px rgba(0,0,0,0.2);
551+
}
552+
.back-to-top.visible { opacity: 1; visibility: visible; }
553+
.back-to-top:hover {
554+
color: var(--text);
555+
border-color: var(--hover-border);
556+
background: var(--card-hover);
557+
transform: translateY(-3px);
558+
box-shadow: 0 8px 30px rgba(0,0,0,0.3);
559+
}
560+
.back-to-top svg { width: 22px; height: 22px; }
561+
542562
@media (max-width: 768px) {
543563
.bento { grid-template-columns: 1fr; }
544564
.why-grid { grid-template-columns: 1fr; }
@@ -548,13 +568,16 @@
548568
</style>
549569
</head>
550570
<body>
551-
<div id="scroll-progress"></div>
552571
<div class="lang-switcher">
553572
<button class="lang-btn active" data-lang="zh" aria-label="中文">中文</button>
554573
<button class="lang-btn" data-lang="en" aria-label="English">EN</button>
555574
</div>
556575
<canvas id="particles"></canvas>
557576

577+
<button type="button" class="back-to-top" id="back-to-top" aria-label="回到顶部">
578+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 15l-6-6-6 6"/></svg>
579+
</button>
580+
558581
<div class="quick-nav">
559582
<a href="#why" data-i18n="navWhy">为什么选择</a>
560583
<a href="#screenshots" data-i18n="navScreenshots">截图</a>
@@ -776,16 +799,16 @@ <h2 class="section-title animate-el"><span data-i18n="donateTitle">☕ 支持开
776799
applyLang(lang);
777800

778801
// Scroll progress
779-
const prog = document.getElementById('scroll-progress');
780-
window.addEventListener('scroll', () => {
781-
const sc = window.scrollY, sh = Math.max(1, document.documentElement.scrollHeight - window.innerHeight);
782-
prog.style.width = (sc / sh * 100) + '%';
783-
});
784-
785-
// Quick nav visibility
802+
// Quick nav & back-to-top visibility
786803
const quickNav = document.querySelector('.quick-nav');
804+
const backToTop = document.getElementById('back-to-top');
787805
window.addEventListener('scroll', () => {
788-
quickNav.classList.toggle('visible', window.scrollY > window.innerHeight * 0.5);
806+
const show = window.scrollY > window.innerHeight * 0.5;
807+
quickNav.classList.toggle('visible', show);
808+
backToTop.classList.toggle('visible', show);
809+
});
810+
backToTop.addEventListener('click', () => {
811+
window.scrollTo({ top: 0, behavior: 'smooth' });
789812
});
790813

791814
// Particles

0 commit comments

Comments
 (0)