fix: prevent animation flickering and refine post card hover state
All checks were successful
Deploy Theme / deploy (push) Successful in 14s

This commit is contained in:
2026-02-22 09:27:29 +01:00
parent 9d1b6dee52
commit 393b78a0e8
3 changed files with 18 additions and 16 deletions

View File

@@ -206,6 +206,14 @@
fill: currentColor;
}
.post-grid-item {
opacity: 0;
}
.post-grid-item.animated {
opacity: 1;
}
@keyframes fadeInUp {
from {
opacity: 0;
@@ -216,7 +224,3 @@
.animate-fadeInUp {
animation: fadeInUp 0.5s ease-out forwards;
}
.post-grid-item.animated {
opacity: 1;
}

View File

@@ -20,12 +20,15 @@ document.addEventListener('DOMContentLoaded', () => {
// Re-run animation and other setup when HTMX settles new content
// Use document instead of document.body to persist across boosted navigation
document.addEventListener('htmx:afterSettle', (event) => {
// Global page fade-in animation
const mainContent = document.getElementById('main-content');
if (mainContent) {
mainContent.classList.remove('animate-fadeInUp');
void mainContent.offsetWidth; // Force reflow to restart animation
mainContent.classList.add('animate-fadeInUp');
// Global page fade-in animation - only on full boosted navigations
if (event.detail.boosted) {
const mainContent = document.getElementById('main-content');
if (mainContent) {
mainContent.classList.remove('animate-fadeInUp');
void mainContent.offsetWidth; // Force reflow to restart animation
mainContent.classList.add('animate-fadeInUp');
}
animateGridItems();
}
// If the settled element is the posts-container or contains grid items
@@ -33,10 +36,5 @@ document.addEventListener('DOMContentLoaded', () => {
if (target.id === 'posts-container' || target.querySelector('.post-grid-item')) {
animateGridItems(target);
}
// Handle global boost re-animation
if (event.detail.boosted) {
animateGridItems();
}
});
});