Skip to content

Commit e13483f

Browse files
committed
fix random image index bug
1 parent 0292581 commit e13483f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/PageHeader/HomePage.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ const { config } = Astro.props;
4747
// find all hero image elements
4848
const images = document.querySelectorAll("img.hero-image");
4949
if (images.length > 1) {
50-
const shownImageInd = Math.round(Math.random() * images.length);
50+
const shownImageInd = Math.round(Math.random() * (images.length - 1));
51+
console.log(shownImageInd);
5152
// hide the default one
5253
images[0].classList.add("hidden");
5354
// show a random one

0 commit comments

Comments
 (0)