From 49832533119031dcf3887dfac5403ed7287762de Mon Sep 17 00:00:00 2001
From: Vaica <94612053+zqlit@users.noreply.github.com>
Date: Thu, 22 Jan 2026 20:07:43 +0800
Subject: [PATCH] =?UTF-8?q?fixed=20=E8=BF=94=E5=9B=9E=E9=A1=B6=E9=83=A8?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
themes/Ying/layouts/_default/ly.html | 2 +
themes/Ying/layouts/_default/single.html | 2 +-
themes/Ying/layouts/partials/footer.html | 3 ++
themes/Ying/layouts/partials/head.html | 2 +-
themes/Ying/static/css/main.css | 49 ++++++++++++++++++++++++
themes/Ying/static/js/main.js | 43 ++++++++++++++++++---
6 files changed, 93 insertions(+), 8 deletions(-)
diff --git a/themes/Ying/layouts/_default/ly.html b/themes/Ying/layouts/_default/ly.html
index 71305eda..3894cecb 100644
--- a/themes/Ying/layouts/_default/ly.html
+++ b/themes/Ying/layouts/_default/ly.html
@@ -1,5 +1,7 @@
{{ define "main" }}
+
+
/{{ .Params.pid | default .Title }}.html
{{ .Content }}
diff --git a/themes/Ying/layouts/_default/single.html b/themes/Ying/layouts/_default/single.html
index 76f591dc..62d5b51b 100644
--- a/themes/Ying/layouts/_default/single.html
+++ b/themes/Ying/layouts/_default/single.html
@@ -5,7 +5,7 @@
{{ .Title }}
+
+
+
diff --git a/themes/Ying/layouts/partials/head.html b/themes/Ying/layouts/partials/head.html
index 5e4e0f32..b1cf9415 100644
--- a/themes/Ying/layouts/partials/head.html
+++ b/themes/Ying/layouts/partials/head.html
@@ -133,7 +133,7 @@
-
+
{{ if or (eq .Type "about") (eq .Type "post") }}
diff --git a/themes/Ying/static/css/main.css b/themes/Ying/static/css/main.css
index 1542e74b..1a38c4a3 100644
--- a/themes/Ying/static/css/main.css
+++ b/themes/Ying/static/css/main.css
@@ -756,6 +756,8 @@ ul {
color: #111827;
text-decoration: none;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
+ z-index: 2147483647; /* Ensure it's on top */
+ cursor: pointer;
}
#scrollUp::before {
@@ -2795,6 +2797,53 @@ img[atk-emoticon] {
/* GenericInserted */ [data-theme="dark"] .chroma .gi { color:#50fa7b;font-weight:bold }
/* GenericOutput */ [data-theme="dark"] .chroma .go { color:#44475a }
/* GenericPrompt */ [data-theme="dark"] .chroma .gp { }
+
+/* Back to Top Button */
+#back-to-top {
+ position: fixed;
+ bottom: 30px;
+ right: 30px;
+ width: 40px;
+ height: 40px;
+ background-color: var(--bankuai-color);
+ color: var(--text-content-color);
+ border-radius: 50%;
+ text-align: center;
+ line-height: 40px;
+ font-size: 24px;
+ box-shadow: 0 2px 5px rgba(0,0,0,0.2);
+ cursor: pointer;
+ z-index: 2147483647;
+ opacity: 0;
+ visibility: hidden;
+ transition: opacity 0.3s, visibility 0.3s, background-color 0.3s, transform 0.3s;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ text-decoration: none;
+}
+
+#back-to-top.show {
+ opacity: 1;
+ visibility: visible;
+}
+
+#back-to-top:hover {
+ background-color: var(--erji-color);
+ color: #fff;
+ transform: translateY(-3px);
+}
+
+[data-theme="dark"] #back-to-top {
+ background-color: var(--bankuai-dark-color);
+ color: var(--text-content-dark-color);
+ box-shadow: 0 2px 5px rgba(255,255,255,0.1);
+}
+
+[data-theme="dark"] #back-to-top:hover {
+ background-color: #444;
+ color: #fff;
+}
/* GenericStrong */ [data-theme="dark"] .chroma .gs { }
/* GenericSubheading */ [data-theme="dark"] .chroma .gu { font-weight:bold }
/* GenericTraceback */ [data-theme="dark"] .chroma .gt { }
diff --git a/themes/Ying/static/js/main.js b/themes/Ying/static/js/main.js
index 59f2a7a9..b01af05b 100644
--- a/themes/Ying/static/js/main.js
+++ b/themes/Ying/static/js/main.js
@@ -10,12 +10,43 @@ function isMobile() {
// 文章图片灯箱
window.ViewImage && ViewImage.init('.post-content img');
-// 激活返回顶部插件
-$(function () {
- $.scrollUp({
- animation: 'fade',
- scrollImg: true
- });
+// Pure JavaScript Back to Top (High Performance)
+document.addEventListener('DOMContentLoaded', function() {
+ var backToTopButton = document.getElementById('back-to-top');
+ if (backToTopButton) {
+ var isVisible = false;
+ var ticking = false;
+
+ function update() {
+ if (window.scrollY > 300) {
+ if (!isVisible) {
+ backToTopButton.classList.add('show');
+ isVisible = true;
+ }
+ } else {
+ if (isVisible) {
+ backToTopButton.classList.remove('show');
+ isVisible = false;
+ }
+ }
+ ticking = false;
+ }
+
+ window.addEventListener('scroll', function() {
+ if (!ticking) {
+ window.requestAnimationFrame(update);
+ ticking = true;
+ }
+ }, { passive: true });
+
+ backToTopButton.addEventListener('click', function(e) {
+ e.preventDefault();
+ window.scrollTo({
+ top: 0,
+ behavior: 'smooth'
+ });
+ });
+ }
});
// loader定时器