One of the performance suggestions of Google pagespeed insights is to delay loading and the opening image of word press. WordPress’s deferred load image reduces initial load time and page payload without sacrificing content. Deferred loading improves the experience of visitors by providing what they need only when they need it. In all cases that lead to congestion of slowly loading images, the efficiency of loading images is higher than that of loading images. In this post, we will show you how deferred loading can improve page performance and how it works. Then, let’s look at how to delay loading images in word press. The
What is lazy Roding? Lazy loding is a technique that increases the initial page speed and payload by delaying the loading of \
Deferred loading does not load assets until they are needed, but if the user does not arrive, no assets are loaded. Why is delayed loading better than regular loading? WordPress deferred loading images can improve site performance, SEO, and visitor experience. Lazy loading provides an easier initial page and adds elements as needed. Lazy loading allows users to interact with the site because the browser builds the DOM first, even if the entire page is not loaded. Delayed loading does not actually reduce the size of the image file or web page file. If the page size is 3MB, the page size is the size with or without delayed loading. This is different from compressed images. However, delayed loading greatly improves the way users identify sites. Feel faster enough to stay on the page. The
Google also uses page speed as a ranking factor and suggests delaying image loading to improve performance. In addition, Google provides higher rankings for faster sites, so delaying loading images is an indirect way to improve image SEO. Male Smush Pro creates a page with multiple large images before activating delayed loading. Google pagespeed insights audited my test site. Just using Smush pro to add delayed loading, my score increased from 89 to 91 (for example, Smush now has delayed loading). Although it seems nothing, this is the difference between my friends’ average (50-89) and fast (90-100). The
When Smush Pro delay loading is activated, lazy loading also uses less data. Visitors using a slow mobile connection will be greatly appreciated. Delaying loading reduces the resources that visitors use when they stop browsing and go to the next page without loading all images. How does lazy loading work? WordPress postpones off screen images without plug-ins: First, you must determine which images to delay loading. You must delay loading images that are not displayed in viewports and that do not contribute to the page structure. For example, the logo image in the title or the hero image on the body text should not be loaded late. To provide the best user experience, visitors must load images within about 500 PX in the viewport,
There is time to load before arrival. The
If you use anti delay loading to ensure that the image does not load normally, you must ensure that the image does not load normally at the site. One way to do this on an image is to delete the image URL from the SRC attribute, move it to another attribute, such as data SRC, and save it temporarily. After you decide how the browser detects an image in the viewport, what you need to do is work with how the browser determines whether the image enters the viewport. You can use JavaScript event handlers or the intersection observer API. The
If JavaScript event handler browser compatibility is important, using the scroll, resize, and orientationchange JavaScript event handlers is an ideal method because it is compatible with all browsers to ensure that elements reach the viewport. Unfortunately, to do this, you must include additional steps to detect element visibility using getboundingclientrect. In addition, there may be some delays when rendering images. You can see an example here. The cross observer API the cross observer API is the most modern and efficient way to recognize when a compatible browser transfers an image to a viewport. It is also faster than using event handlers. You can write less code, because you only need to register the observer, you can skip the part that needs to consider the image visibility detection method, observe the elements, and determine what the browser should do when displaying the image. The
The intersection observer API provides quite good support between browsers, but it has not been widely adopted. Therefore, it may be necessary to use JavaScript event handlers as a fallback for incompatible browsers. If you move the image URL to the SRC attribute and the browser detects that the image is \
You can add deferred loading to the word press site using the WordPress deferred loading image method plug-in or JavaScript. All produce similar results. Deferred loading is relatively easy to implement, so even if you choose a plug-in, the file size is usually very light, about 1-3kb. Option 1: if you want to use normal JavaScript to use offline image deferred direct JavaScript in word press and want full control, you can directly add deferred loading to the site. The best way to add this functionality is to create plug-ins for JavaScript code. This page contains two examples. One demonstrates how to use the event handler, and the other demonstrates how to use the intersection observer API. The
Option 2: if you want to use the JavaScript delay load library to provide help, there are many options to choose from. Many people follow the above process, so they can start quickly. React lazy – do not use react lazy load library lozad of intersection observer. JS – only use intersection observer, ultra light Blazy – also ultra light, but do not use intersection observer. Yall JS – use intersection observer and fall back to the event handler
Lazysizes – videos and iframes can also be loaded late. JQuery is included in the core of word press, so you can also use the jQuery plug-in in your tasks. The
Option 3: use the deferred load plug-in, but the easiest way to start deferred load is to use the WordPress plug-in. Most advanced image optimization plug-ins, such as Smush pro, have built-in delayed loading. In addition, WordPress. The free version of Smush. Org is also included. To activate deferred loading using Smush, we made the process very simple. Simply go to the delayed loading section of Smush pro and click the activate button. Install Smush pro and receive lazy loading within 2 minutes. If you want to control delayed loading images in more detail, you can use additional options after activating delayed loading. When delayed loading is enabled in Smush pro, images loaded for mobile users are also delayed. Points to pay attention to when image loading is delayed. Delayed loading may not add extra weight to slow down the site, but if it is performed incorrectly, it will hinder the function of the search engine that scrolls the site. When you try to keep an image on a visible part that does not scroll, the folded part varies from device to device, so keep this in mind when deciding which image to postpone. Use a placeholder image instead of leaving the SRC attribute blank. Then, specify the height and width of the image to prevent the content from moving when the image is loaded. Use the male annotation to specify what should happen when the accessor disables JavaScript. This is why delaying Daya off screen images and other assets is an excellent and simple way to improve site performance. This technology is applicable to all images on the website label, from images on the home page to images on posts and pages. To delay loading the background image in CSS, use a similar technique, but specify the image as the target using the CSS identifier. The following is an example of a method to delay loading a background image: The easiest way to start deferred loading is to use Smush free or Smush pro. Smush Pro also adds additional features to help other Google pagespeed insights opportunities. You can convert images to webp files, provide images in next-generation formats, and use Smush Pro CDN to resize the images to fit. Smush Pro is also compatible with the popular WP retina 2x plug-in, so you can delay loading large retina images without slowing down WordPress. Please use Smush Pro yourself or for free as part of the free trial of membership and make sure how much change your website can make. Do you attempt to delay loading images on the site? Has Google pagespeed insights improved? Tags: image JavaScript J query performance