Skip to content

Commit

Permalink
feat: remove preload, ineffective
Browse files Browse the repository at this point in the history
  • Loading branch information
twhite313 committed Jan 14, 2025
1 parent 6a9c47f commit fb1d355
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions eds/blocks/hero/hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,10 @@ export default function decorate(block) {
imgCollection.forEach((img) => {
img.setAttribute('loading', 'eager');
img.setAttribute('fetchpriority', 'high');
// console.log the images href
console.log(img.src);
// preload the images
const preloadLink = document.createElement('link');
preloadLink.href = img.src;
preloadLink.rel = 'preload';
preloadLink.as = 'image';
document.querySelector('.hero-container').insertBefore(preloadLink, document.querySelector('.hero-container').firstChild);
});
} else {
imgCollection.forEach((img) => {
img.setAttribute('loading', 'eager');
img.setAttribute('loading', 'lazy');
});
}

Expand Down

0 comments on commit fb1d355

Please sign in to comment.