Hotfix - code hanging
This commit is contained in:
@ -32,6 +32,7 @@ const randomizeHeroBackground = () => {
|
|||||||
if (images.length === 0) return;
|
if (images.length === 0) return;
|
||||||
let currentIndex = Math.floor(Math.random() * images.length);
|
let currentIndex = Math.floor(Math.random() * images.length);
|
||||||
heroBg.style.backgroundImage = `url(/img/${images[currentIndex]})`;
|
heroBg.style.backgroundImage = `url(/img/${images[currentIndex]})`;
|
||||||
|
if (images.length < 2) return; // <-- Prevent interval if only one image
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
let nextIndex;
|
let nextIndex;
|
||||||
do {
|
do {
|
||||||
|
Reference in New Issue
Block a user