Type
magento2-module
A Magento 2 module that adds support for lazy loading of images.
magento2-module
MIT
None
None
None
None
None
A Magento 2 module that adds support for lazy loading of images.
Magento\Catalog\Block\Product\Image
<img>
elements:
lazyload
classsrc
attribute to data-src
src
with transparent 1px x 1px image to avoid broken image links prior to lazy load (see product image templates as example)loading="lazy"
to enable native browser lazy-loading where possible. Note that this is not true native lazy-loading, as the lazysizes
script and its native-loading
plug-in need to be run, so there's still a dependency on JavaScript before affected images will show.preload_elements
layout argument allows you to specify selectors of which elements can be preloaded. This can be configured per page.lazypreload
class on element(s) you wish to preload.composer require fisheye/module-lazyload
php bin/magento module:enable Fisheye_Lazyload
php bin/magento setup:upgrade
Issues, forks and pull requests welcomed :)