Skip to content

Commit

Permalink
fix: enable lazy loading of product thumbnail images (#10343)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanegigandet authored May 23, 2024
1 parent 8134720 commit 264f02e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions html/js/product-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ function display_products(target, product_groups, user_prefs) {
product_html += '<div class="list_product_img_div">';

if (product.image_front_small_url) {
product_html += `<img src="${product.image_front_small_url}" class="list_product_img" alt="${product.product_display_name}">`;
product_html += `<img src="${product.image_front_small_url}" class="list_product_img" alt="${product.product_display_name}" loading="lazy">`;
}
else {
product_html += `<img src="/images/icons/dist/packaging.svg" style="filter:invert(.9)" class="list_product_img" alt="${product.product_display_name}">`;
product_html += `<img src="/images/icons/dist/packaging.svg" style="filter:invert(.9)" class="list_product_img" alt="${product.product_display_name}" loading="lazy">`;
}

product_html += "</div>";
Expand All @@ -275,7 +275,7 @@ function display_products(target, product_groups, user_prefs) {
title += " - " + attribute.missing;
}

product_html += '<img class="list_product_icons" src="' + attribute.icon_url + '" title="' + title + '" alt="' + attribute.title + '" >';
product_html += '<img class="list_product_icons" src="' + attribute.icon_url + '" title="' + title + '" alt="' + attribute.title + '" loading="lazy">';
}
});
product_html += '</div>';
Expand Down

0 comments on commit 264f02e

Please sign in to comment.