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 = '✅ ';