Skip to content

Commit

Permalink
Add alt attribute to image in <figure> (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
manav-sharma69 authored Oct 18, 2024
1 parent a6ee814 commit b6975ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion view-transitions/spa/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function init() {
})

galleryImg.src = `images/${ imageData[0].file }.jpg`;
galleryImg.alt = imageData[0].name;
galleryCaption.textContent = imageData[0].name;
}

Expand All @@ -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;
};

Expand All @@ -60,4 +62,4 @@ function updateView(event) {
const transition = document.startViewTransition(() => displayNewImage());
}

init();
init();

0 comments on commit b6975ef

Please sign in to comment.