This Lazyload Elements plugin allows you to improve your website’s performance by lazy loading specific sections or elements. To use this feature, simply add the CSS class lazy-section to any section or element. For dynamic content generated by shortcodes, use the data-lazy-shortcode attribute.
How to Use
Edit Your Page, for example with Elementor:
Navigate to the page you want to edit in your WordPress dashboard.
Click on Edit with Elementor to open the Elementor editor.
Static Content:
Select the Section or Element:
Click on the section or element you wish to lazy load.
Add the CSS Class:
In the Elementor panel, go to the Advanced tab.
Locate the CSS Classes field.
Enter the class name lazy-section.
Dynamic Content (Shortcodes):
Create a Section:
Add a new section in Elementor where you want the dynamic content to appear.
Add HTML Widget:
Add an HTML widget to the section.
Add Lazy Load HTML:
In the HTML widget, add the following code, replacing [your-shortcode] with your actual shortcode:
The Instagram feed will load only when the section comes into the viewport.
Example 3: Lazy Loading a YouTube Video
Edit the Section:
Click on the section containing the YouTube video in Elementor.
Add the CSS Class:
Go to the Advanced tab.
In the CSS Classes field, add lazy-section.
Save and Preview:
Save your changes and preview the page.
The YouTube video will load only when the section comes into the viewport or when the user interacts with the placeholder.
Additional Information
Lazyload Elements uses modern JavaScript techniques, including the Intersection Observer API, to detect when elements are in the viewport. For browsers that do not support Intersection Observer, a fallback ensures that the elements are still loaded properly.
This plugin requires no additional configuration. Simply add the lazy-section class to any Elementor section or element, and the plugin handles the rest.
For more detailed information and examples contact me at [email protected]
I ❤ WordPress
The I Love WordPress blog focuses on everything related to WordPress and website optimization. From WordPress tutorials and plugin reviews, to actionable.