diff --git a/scripts/scripts.js b/scripts/scripts.js index 3621d81..4505cea 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -149,14 +149,15 @@ const eagerLoad = (img) => { (async function loadLCPImage() { const marquee = document.querySelector('.marquee'); - if (marquee) { - if (marquee.classList.contains('split')) { - marquee.querySelectorAll('img').forEach(eagerLoad); - } else { - eagerLoad(marquee.querySelector('img')); - } - } else { + if (!marquee) { eagerLoad(document.querySelector('img')); + return; + } + + if (marquee.classList.contains('split')) { + marquee.querySelectorAll('img').forEach(eagerLoad); + } else { + eagerLoad(marquee.querySelector('img')); } }());