Lazy loads media using the native browser feature. Learn more about the new
loading attribute or view the WordPress core ticket where inclusion of a similar implementation in WordPress core itself is being discussed.
loading attribute is supported by the browser, a
noscript variant of the respective element will be added that also includes the
loading attribute without any further changes.
“Native” means “Fast”
This plugin largely does away with this pattern. It relies on the new
Last but not least, a neat thing to keep in mind is that this plugin will essentially improve itself over time, as more browsers roll out support for the
Just activate the plugin, and all your images and iframes in post content will be loaded lazily.
- Upload the entire
native-lazyloadfolder to the
/wp-content/plugins/directory or download it through the WordPress back end.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Where are the plugin’s settings?
This plugin does not have a settings screen. Just by activating it, the plugin will work.
- How can I prevent an image or iframe from being loaded lazily?
You can add a class
skip-lazyto indicate to the plugin you would like to skip lazy loading for this image or iframe.
loadingattribute yet. The file includes logic to still autoload the image in a non-native way. If you prefer to purely rely on the
loadingattribute and not provide any fallback, you can easily disable it by adding a line
add_filter( 'native_lazyload_fallback_script_enabled', '__return_false' )somewhere in your site’s codebase.
- Does this work with AMP?
If you use AMP, you don’t actually need this, since AMP intelligently lazy loads media out of the box. Still, the plugin is built in a way that it will not break AMP compatibility, just to make sure.
- Where should I submit my support request?
For regular support requests, please use the wordpress.org support forums. If you have a technical issue with the plugin where you already have more insight on how to fix it, you can also open an issue on Github instead.
- How can I contribute to the plugin?
If you have some ideas to improve the plugin or to solve a bug, feel free to raise an issue or submit a pull request in the Github repository for the plugin. Please stick to the contributing guidelines.
You can also contribute to the plugin by translating it. Simply visit translate.wordpress.org to get started.
Contributors and Developers
“Native Lazyload” is open source software. The following people have contributed to this plugin.Contributors
- Fix broken images which are using data URI scheme (eg base64-encoded images). Props ieim.
- Fix images in IE11 not being loaded until the user starts scrolling. Props Soean.
- Fix image loading script not working in IE10 and other browsers that do not support
- Improve compatibility with other plugins by using a more specific class and only adding it for JS fallback.
- Run lazy-load script on
DOMContentLoadedwhen necessary to improve compatibility with plugins like Autoptimize.
- Do not transform elements inside an Ajax response due to lack of predictability of the context and script execution.
- Initial release