fixed 修复首页闪烁的bug

This commit is contained in:
Vaica committed 2026-02-05 21:56:27 +08:00
1 parent 1facf78c3a
commit 9dfab51791
3 files changed
+25 -2

No files matched your search

+5
View File
@@ -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 {
@@ -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) {
+16 -1
View File
@@ -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 = '✅ ';