fix: prevent animation flickering and refine post card hover state
All checks were successful
Deploy Theme / deploy (push) Successful in 14s
All checks were successful
Deploy Theme / deploy (push) Successful in 14s
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user