From 9dfab51791c542ddd8e22e7c0db8261f9cf134fd Mon Sep 17 00:00:00 2001 From: Vaica <94612053+zqlit@users.noreply.github.com> Date: Thu, 5 Feb 2026 21:56:27 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E9=97=AA=E7=83=81=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/Ying/assets/css/main.css | 5 +++++ themes/Ying/assets/js/modules/floating-tools.js | 5 ++++- themes/Ying/assets/js/modules/utils.js | 17 ++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/themes/Ying/assets/css/main.css b/themes/Ying/assets/css/main.css index d65337c5..5fc59370 100644 --- a/themes/Ying/assets/css/main.css +++ b/themes/Ying/assets/css/main.css @@ -3467,6 +3467,9 @@ input[type=submit] { /* GPU Acceleration for container */ transform: translateZ(0); will-change: transform; + /* Ensure visibility stability */ + opacity: 1; + visibility: visible; } .floating-tools a { @@ -3532,6 +3535,7 @@ input[type=submit] { will-change: opacity, transform, height; } +/* Ensure consistent display state when active */ #back-to-top.show { opacity: 1; visibility: visible; @@ -3541,6 +3545,7 @@ input[type=submit] { transform: translate3d(0, 0, 0) scale(1); pointer-events: auto; border-width: 1px; + display: flex; /* Force flex display to keep icon centered */ } #back-to-top.show:hover { diff --git a/themes/Ying/assets/js/modules/floating-tools.js b/themes/Ying/assets/js/modules/floating-tools.js index 42f0039c..dc0f8cee 100644 --- a/themes/Ying/assets/js/modules/floating-tools.js +++ b/themes/Ying/assets/js/modules/floating-tools.js @@ -160,7 +160,10 @@ window.initFloatingTools = function() { }; // Initial check - checkCommentVisibility(toComments); + // Use setTimeout to avoid initial render flickering + setTimeout(function() { + checkCommentVisibility(toComments); + }, 100); var newToComments = toComments.cloneNode(true); if (toComments.parentNode) { diff --git a/themes/Ying/assets/js/modules/utils.js b/themes/Ying/assets/js/modules/utils.js index 6881a4f9..86e1126f 100644 --- a/themes/Ying/assets/js/modules/utils.js +++ b/themes/Ying/assets/js/modules/utils.js @@ -35,15 +35,30 @@ window.showToast = function(text, type) { z-index: 9999; font-size: 14px; opacity: 0; - transition: opacity 0.3s; + transition: opacity 0.3s, background-color 0.3s; pointer-events: none; display: flex; align-items: center; gap: 8px; `; + + // Add dark mode support class + toast.setAttribute('data-toast', 'true'); document.body.appendChild(toast); } + // Update toast style based on theme + const isDark = document.documentElement.getAttribute('data-theme') === 'dark'; + if (isDark) { + toast.style.background = 'rgba(255, 255, 255, 0.9)'; + toast.style.color = '#333'; + toast.style.boxShadow = '0 4px 12px rgba(0,0,0,0.3)'; + } else { + toast.style.background = 'rgba(0,0,0,0.8)'; + toast.style.color = 'white'; + toast.style.boxShadow = '0 4px 12px rgba(0,0,0,0.1)'; + } + // Simple icon mapping for fallback let icon = ''; if (type === 'success') icon = '✅ ';