添加返回顶部按钮

This commit is contained in:
MasonLiu 2026-06-02 23:29:42 +08:00
parent c4b1f8fd1b
commit 9949072ae0
7 changed files with 233 additions and 0 deletions

View File

@ -771,3 +771,55 @@ body.dark-mode .beian-divider {
font-size: 0.8rem; font-size: 0.8rem;
} }
} }
/* 返回顶部按钮 */
.back-to-top {
position: fixed;
bottom: 30px;
right: 30px;
width: 45px;
height: 45px;
border-radius: 50%;
background: var(--accent-color, #3498db);
color: white;
border: none;
font-size: 1.5em;
cursor: pointer;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.back-to-top.show {
opacity: 1;
visibility: visible;
}
.back-to-top:hover {
transform: translateY(-3px);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
background: #2980b9;
}
body.dark-mode .back-to-top {
background: #63b3ed;
}
body.dark-mode .back-to-top:hover {
background: #4299e1;
}
@media (max-width: 768px) {
.back-to-top {
bottom: 20px;
right: 20px;
width: 40px;
height: 40px;
font-size: 1.3em;
}
}

View File

@ -558,3 +558,50 @@ body.dark-mode .download-btn:hover {
::-webkit-scrollbar-thumb:hover { ::-webkit-scrollbar-thumb:hover {
background: var(--text-secondary); background: var(--text-secondary);
} }
/* 返回顶部按钮 */
.back-to-top {
position: fixed;
bottom: 30px;
right: 30px;
width: 45px;
height: 45px;
border-radius: 50%;
background: var(--accent-color);
color: white;
border: none;
font-size: 1.5em;
cursor: pointer;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.back-to-top.show {
opacity: 1;
visibility: visible;
}
.back-to-top:hover {
transform: translateY(-3px);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
body.dark-mode .back-to-top {
background: #63b3ed;
}
@media (max-width: 768px) {
.back-to-top {
bottom: 20px;
right: 20px;
width: 40px;
height: 40px;
font-size: 1.3em;
}
}

View File

@ -523,3 +523,50 @@ body.dark-mode .download-btn:hover {
::-webkit-scrollbar-thumb:hover { ::-webkit-scrollbar-thumb:hover {
background: var(--text-secondary); background: var(--text-secondary);
} }
/* 返回顶部按钮 */
.back-to-top {
position: fixed;
bottom: 30px;
right: 30px;
width: 45px;
height: 45px;
border-radius: 50%;
background: var(--accent-color);
color: white;
border: none;
font-size: 1.5em;
cursor: pointer;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.back-to-top.show {
opacity: 1;
visibility: visible;
}
.back-to-top:hover {
transform: translateY(-3px);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
body.dark-mode .back-to-top {
background: #63b3ed;
}
@media (max-width: 768px) {
.back-to-top {
bottom: 20px;
right: 20px;
width: 40px;
height: 40px;
font-size: 1.3em;
}
}

BIN
assets/db/sechub.db Normal file

Binary file not shown.

View File

@ -387,5 +387,34 @@ try {
}); });
})(); })();
</script> </script>
<!-- 返回顶部按钮 -->
<button id="back-to-top" class="back-to-top" title="返回顶部">
</button>
<script>
// 返回顶部功能
(function() {
const backToTopBtn = document.getElementById('back-to-top');
// 滚动时显示/隐藏按钮
window.addEventListener('scroll', function() {
if (window.pageYOffset > 300) {
backToTopBtn.classList.add('show');
} else {
backToTopBtn.classList.remove('show');
}
});
// 点击返回顶部
backToTopBtn.addEventListener('click', function() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
})();
</script>
</body> </body>
</html> </html>

View File

@ -339,5 +339,34 @@ try {
}); });
})(); })();
</script> </script>
<!-- 返回顶部按钮 -->
<button id="back-to-top" class="back-to-top" title="返回顶部">
</button>
<script>
// 返回顶部功能
(function() {
const backToTopBtn = document.getElementById('back-to-top');
// 滚动时显示/隐藏按钮
window.addEventListener('scroll', function() {
if (window.pageYOffset > 300) {
backToTopBtn.classList.add('show');
} else {
backToTopBtn.classList.remove('show');
}
});
// 点击返回顶部
backToTopBtn.addEventListener('click', function() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
})();
</script>
</body> </body>
</html> </html>

View File

@ -356,5 +356,34 @@ try {
}); });
})(); })();
</script> </script>
<!-- 返回顶部按钮 -->
<button id="back-to-top" class="back-to-top" title="返回顶部">
</button>
<script>
// 返回顶部功能
(function() {
const backToTopBtn = document.getElementById('back-to-top');
// 滚动时显示/隐藏按钮
window.addEventListener('scroll', function() {
if (window.pageYOffset > 300) {
backToTopBtn.classList.add('show');
} else {
backToTopBtn.classList.remove('show');
}
});
// 点击返回顶部
backToTopBtn.addEventListener('click', function() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
})();
</script>
</body> </body>
</html> </html>