Compare commits

..

2 Commits

Author SHA1 Message Date
27df97522c Merge pull request 'fix: handle script with swup' (#388) from main into release
All checks were successful
release-image / guarddog (push) Successful in 25s
release-image / build (push) Successful in 1m52s
release-image / semantic-release (push) Successful in 54s
release-image / release-harbor (push) Successful in 5m35s
release-image / release-gitea (push) Successful in 5m34s
Reviewed-on: #388
2026-03-14 18:20:15 +00:00
8d1d47dc4f fix: handle script with swup
All checks were successful
test-build / guarddog (push) Successful in 33s
test-build / build (push) Successful in 1m41s
renovate / renovate (push) Successful in 1m26s
2026-03-14 13:17:33 -05:00

View File

@@ -82,7 +82,7 @@ const images = await Promise.all(imagesData.map(async (img) => ({
</section>
<script>
document.addEventListener('astro:page-load', () => {
function initHeroImage() {
const container = document.getElementById('hero-image-container');
if (container) {
const images = container.querySelectorAll('.hero-image');
@@ -96,5 +96,13 @@ const images = await Promise.all(imagesData.map(async (img) => ({
images[randomIndex].classList.add('flex');
}
}
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initHeroImage);
} else {
initHeroImage();
}
if ((window as any).swup) {
(window as any).swup.hooks.on('page:view', initHeroImage);
}
</script>