landofcoder/module-lazyload
最新稳定版本:1.0.0
Composer 安装命令:
composer require landofcoder/module-lazyload
包简介
A Magento 2 module that adds support for lazy loading of images.
README 文档
README
Overview
A Magento 2 module that adds support for lazy loading of images.
Features
- Utilises the lazysizes script to add lazy load support for images
- Lazy loading is automatically applied to all* product images
- *Any image created via
Magento\Catalog\Block\Product\Image - This includes:
- Product listing (category, search, product list widget)
- Product relations (related, upsell, crosssell)
- Product comparison
- Recently viewed
- Cart thumbnails
- Wishlist
- *Any image created via
- Support can be added to any further images by adding the following to
<img>elements:- Add
lazyloadclass - Change the
srcattribute todata-src - Optional: add a dummy
srcwith transparent 1px x 1px image to avoid broken image links prior to lazy load (see product image templates as example)
- Add
- Preloading
- Preloading means the media source will be loaded even if not in the viewport such as megamenu icons/images.
- The
preload_elementslayout argument allows you to specify selectors of which elements can be preloaded. This can be configured per page. - Use the
lazypreloadclass on element(s) you wish to preload.
Compatibility
- Magento Community Edition / Enterprise Edition 2.2.x (see older releases for 2.0 / 2.1 support)
- Supports Magento 2 Full Page Cache (including Varnish)
Installation
composer require landofcoder/module-lazyload
php bin/magento module:enable Lof_Lazyload
php bin/magento setup:upgrade
Contributing
Issues, forks and pull requests welcomed :)
统计信息
- 总下载量: 2.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-05