Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable lazy loading of product thumbnail images #10343

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading