Skip to content

Commit

Permalink
No nested ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
auniverseaway committed Jan 24, 2024
1 parent 930beed commit d2f4330
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}());

Expand Down

0 comments on commit d2f4330

Please sign in to comment.