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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -20,23 +20,21 @@ 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
|
||||
// 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
|
||||
const target = event.detail.target;
|
||||
if (target.id === 'posts-container' || target.querySelector('.post-grid-item')) {
|
||||
animateGridItems(target);
|
||||
}
|
||||
|
||||
// Handle global boost re-animation
|
||||
if (event.detail.boosted) {
|
||||
animateGridItems();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<article class="post-grid-item opacity-0 h-80">
|
||||
<article class="post-grid-item h-80">
|
||||
<a href="{{url}}" class="group block h-full relative bg-[var(--bg-secondary)] rounded-xl shadow-lg overflow-hidden transition-all duration-500 hover:shadow-2xl hover:-translate-y-2">
|
||||
{{#if feature_image}}
|
||||
<img
|
||||
|
||||
Reference in New Issue
Block a user