feat: apply global fadeInUp animation to all page transitions
All checks were successful
Deploy Theme / deploy (push) Successful in 16s
All checks were successful
Deploy Theme / deploy (push) Successful in 16s
This commit is contained in:
@@ -20,6 +20,14 @@ 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');
|
||||
}
|
||||
|
||||
// If the settled element is the posts-container or contains grid items
|
||||
const target = event.detail.target;
|
||||
if (target.id === 'posts-container' || target.querySelector('.post-grid-item')) {
|
||||
|
||||
Reference in New Issue
Block a user