async function loadImages() { const images = Array.from(document.getElementsByTagName('img')); await Promise.all( images.map(async image => { if (image.complete) { removeAnimation(image); } else { image.addEventListener('load', () => removeAnimation(image)); } }) ); function removeAnimation(image) { const parent = image.parentElement; if (parent) parent.style.animation = 'none'; } } loadImages();