Skip to content

Commit

Permalink
Merge pull request #884 from adobecom/MWPW-160879
Browse files Browse the repository at this point in the history
MWPW-160879 Add hero-marquee in loadLCPImage
  • Loading branch information
TsayAdobe authored Nov 4, 2024
2 parents e906a48 + c5bd414 commit 67a2f43
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions acrobat/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,12 @@ replaceDotMedia(document);

// Default to loading the first image as eager.
(async function loadLCPImage() {
const marquee = document.querySelector('.marquee'); // first marquee only
const blocks = '.marquee,.hero-marquee';
const marquee = document.querySelector(blocks); // first marquee only
if (marquee) {
const index = window.browser.isMobile ? 1 : 3;
const selectorBG = `.marquee > div:nth-child(1) > div:nth-of-type(${index}) img`;
const selectorFG = '.marquee > div:nth-child(2) img';
const selectorBG = `${blocks} > div:nth-child(1) > div:nth-of-type(${index}) img`;
const selectorFG = `${blocks} > div:nth-child(2) img`;
marquee.querySelector(selectorBG)?.setAttribute('loading', 'eager');
marquee.querySelector(selectorFG)?.setAttribute('loading', 'eager');
}
Expand Down

0 comments on commit 67a2f43

Please sign in to comment.