diff --git a/view-transitions/spa/script.js b/view-transitions/spa/script.js index e54245d7..6b583993 100644 --- a/view-transitions/spa/script.js +++ b/view-transitions/spa/script.js @@ -37,6 +37,7 @@ function init() { }) galleryImg.src = `images/${ imageData[0].file }.jpg`; + galleryImg.alt = imageData[0].name; galleryCaption.textContent = imageData[0].name; } @@ -47,6 +48,7 @@ function updateView(event) { const displayNewImage = () => { const mainSrc = `${targetIdentifier.src.split("_th.jpg")[0]}.jpg`; galleryImg.src = mainSrc; + galleryImg.alt = targetIdentifier.alt; galleryCaption.textContent = targetIdentifier.alt; }; @@ -60,4 +62,4 @@ function updateView(event) { const transition = document.startViewTransition(() => displayNewImage()); } -init(); \ No newline at end of file +init();