File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -32,20 +32,28 @@ const { config } = Astro.props;
32
32
33
33
{
34
34
config .data .heroImages .map ((im , i ) => (
35
- <img
36
- class = { ` hero-image ${i > 0 ? " hidden" : " " } ` }
37
- src = { im .image .src }
38
- alt = { im .altText }
39
- loading = { i > 0 ? " lazy" : " eager" }
40
- />
35
+ <div class = { ` relative hero-image-container ${i > 0 ? " hidden" : " " } ` } >
36
+ <img
37
+ class = { " hero-image" }
38
+ src = { im .image .src }
39
+ alt = { im .altText }
40
+ loading = { i > 0 ? " lazy" : " eager" }
41
+ />
42
+ <p
43
+ aria-hidden
44
+ class = { " renderable-alt bg-bg-gray-40 line-clamp-3 absolute top-0 mt-sm mx-sm px-[7.5px] pb-[2.5px] rounded-xl text-body-caption text-ellipsis" }
45
+ >
46
+ { im .altText }
47
+ </p >
48
+ </div >
41
49
))
42
50
}
43
51
</div >
44
52
45
53
<script >
46
54
document.addEventListener("DOMContentLoaded", (event) => {
47
55
// find all hero image elements
48
- const images = document.querySelectorAll("img .hero-image");
56
+ const images = document.querySelectorAll(".hero-image-container ");
49
57
if (images.length > 1) {
50
58
const shownImageInd = Math.round(Math.random() * (images.length - 1));
51
59
console.log(shownImageInd);
You can’t perform that action at this time.
0 commit comments