Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add lazyload compatibility

akjanik07d49d8c6654
diff --git a/templates/product/_filters.html b/templates/product/_filters.html
index 785b0b90d7..1bd7744ee2 100644
--- a/templates/product/_filters.html
+++ b/templates/product/_filters.html
@@ -33,7 +33,7 @@
<h3 class="filter-label">
{{ field.label }}
<div class="collapse-filters-icon">
- <img src="{% static "images/chevron-up.svg" %}">
+ <img class="lazyload lazypreload" data-src="{% static "images/chevron-up.svg" %}">
</div>
</h3>
<div class="filter-form-field" style="display:block">
@@ -52,7 +52,7 @@
<h3 class="filter-label">
{{ field.label }}
<div class="collapse-filters-icon">
- <img src="{% static "images/chevron-up.svg" %}">
+ <img class="lazyload lazypreload" data-src="{% static "images/chevron-up.svg" %}">
</div>
</h3>
<div class="filter-form-field" style="display:block">
diff --git a/templates/product/_items.html b/templates/product/_items.html
index 5b7fe94477..f132cd60fb 100644
--- a/templates/product/_items.html
+++ b/templates/product/_items.html
@@ -9,9 +9,9 @@
<a href="{{ product.get_absolute_url }}" class="link--clean">
<div class="text-center">
<div>
- <img class="img-responsive"
- src="{% product_first_image product method="crop" size="255x255" %}"
- srcset="{% product_first_image product method="crop" size="255x255" %} 1x, {% product_first_image product method="crop" size="510x510" %} 2x"
+ <img class="img-responsive lazyload lazypreload"
+ data-src="{% product_first_image product method="crop" size="255x255" %}"
+ data-srcset="{% product_first_image product method="crop" size="255x255" %} 1x, {% product_first_image product method="crop" size="510x510" %} 2x"
alt="">
<span class="product-list-item-name" title="{{ product }}">{{ product }}</span>
</div>
diff --git a/templates/product/product_list_base.html b/templates/product/product_list_base.html
index 99a9bbe9de..8128ece705 100644
--- a/templates/product/product_list_base.html
+++ b/templates/product/product_list_base.html
@@ -75,13 +75,13 @@
<a href="{% get_sort_by_url choice %}">
<span>{% trans 'ascending' context 'sort by option' %}</span>
<div class="sort-order-icon float-right">
- <img src="{% static "images/arrow-up.svg" %}">
+ <img class="lazyload lazypreload" data-src="{% static "images/arrow-up.svg" %}">
</div>
</a>
<a href="{% get_sort_by_url choice descending=True %}">
<span>{% trans 'descending' context 'sort by option' %}</span>
<div class="sort-order-icon float-right">
- <img src="{% static "images/arrow-down.svg" %}">
+ <img class="lazyload lazypreload" data-src="{% static "images/arrow-down.svg" %}">
</div>
</a>
</div>