Skip to content

Commit

Permalink
Fix BACOM Homepage Marquee LCP
Browse files Browse the repository at this point in the history
When another block is placed above marquee (aside, etc.), that blocks image is selected as LCP when it should be marquee.

This PR will prioritize marquee with a fallback to first document image if there is no marquee present.
  • Loading branch information
auniverseaway authored Jan 22, 2024
1 parent 97ce130 commit 930beed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,13 @@ const eagerLoad = (img) => {
};

(async function loadLCPImage() {
const marquee = document.querySelector('.marquee.split');
const marquee = document.querySelector('.marquee');
if (marquee) {
marquee.querySelectorAll('img').forEach(eagerLoad);
if (marquee.classList.contains('split')) {
marquee.querySelectorAll('img').forEach(eagerLoad);
} else {
eagerLoad(marquee.querySelector('img'));
}
} else {
eagerLoad(document.querySelector('img'));
}
Expand Down

0 comments on commit 930beed

Please sign in to comment.