' + '
' + '
'; // Create a banner shimmering div for loading // Convert the HTML string into a DOM element var bannerShimmeringElement = new DOMParser().parseFromString(bannerHtmlString, 'text/html').body.firstChild; // Insert the Banner Shimmering div before the image in the DOM img.parentNode.insertBefore(bannerShimmeringElement, img); // Show the Banner Shimmering div before the image starts loading bannerShimmeringElement.style.display = 'block'; // When the image loads, hide and remove the loading shimmering div if (img.complete) { bannerShimmeringElement.remove(); } else { img.addEventListener('load', function() { bannerShimmeringElement.remove(); }); } } });
' + '
' + '
'; // Create a banner shimmering div for loading // Convert the HTML string into a DOM element var bannerShimmeringElement = new DOMParser().parseFromString(bannerHtmlString, 'text/html').body.firstChild; // Insert the Banner Shimmering div before the image in the DOM img.parentNode.insertBefore(bannerShimmeringElement, img); // Show the Banner Shimmering div before the image starts loading bannerShimmeringElement.style.display = 'block'; // When the image loads, hide and remove the loading shimmering div if (img.complete) { bannerShimmeringElement.remove(); } else { img.addEventListener('load', function() { bannerShimmeringElement.remove(); }); } } });