Exploring E-Commerce
and Entertainment(VOD) Solutions

document.addEventListener('DOMContentLoaded', function() { // Check if the current URL matches the format for a single post page var isSinglePostPage = window.location.pathname.match(/\/([^/]+)\/$/); // If it's a single post page, preload the featured image and remove lazy loading from it if (isSinglePostPage) { var postFeaturedImage = document.querySelector('.wp-block-group .wp-block-post-featured-image .wp-post-image'); if (postFeaturedImage) { var imageUrl = postFeaturedImage.getAttribute('src'); var preloadLink = document.createElement('link'); preloadLink.rel = 'preload'; preloadLink.href = imageUrl; preloadLink.as = 'image'; document.head.appendChild(preloadLink); // Remove lazy loading attribute from the featured image postFeaturedImage.removeAttribute('loading'); } } // Lazy load all other images const images = document.querySelectorAll('img'); images.forEach(img => { // Check if the image is not the featured image if (img !== postFeaturedImage) { // Append lazy loading attribute to each tag except the featured image img.setAttribute('loading', 'lazy'); } }); });