The filter lazyload_images_placeholder_image will allow you to specify your own placeholder image. For example, if you don’t want lazy images to run on a certain page, you could hook in and disable lazy images for that page.īy default, Jetpack will load a 1×1 transparent gif, but certain implementations may call for something else. You can use the filter lazyload_is_enabled to customize when lazy loading should be enabled. Lazy images are set to be enabled for your entire site by default. These filters allow you to tweak the lazy image functionality. You can add these code snippets to a functionality plugin or to your theme’s functions.php file. The code snippets below provide examples of some of the filters included in the lay images feature. With lazy images, those images will only load when they actually appear on-screen, reducing bandwidth usage by as much as half of what is used without lazy images enabled. That’s using bandwidth to load images that they may not even want to see. For a visitor using a desktop browser, the time and bandwidth necessary to load that page may not be an issue.įor mobile visitors, where the view is much narrower and bandwidth is a more significant concern, this full loading can be problematic. Site performance optimization is incredibly significant.īy default, when a web page loads, it attempts to also load all of the images that it sees in the source. With mobile usage of the Internet now surpassing that of the desktop, the majority of our users are likely accessing our content with mobile devices. Lazy images can drastically improve site performance. This also occurs as the user scrolls down the page and images come into view. When JavaScript then loads, it will look for all images in the current view and replace the src attribute with what is in data-lazy-src. So, for example, would become something like . Lazy images filter the post content and modify image tags so that the src attribute loads a transparent placeholder image.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |