mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Fix code after code review
This commit is contained in:
parent
7503f33b89
commit
6b47bc2252
2 changed files with 10 additions and 5 deletions
|
|
@ -87,11 +87,16 @@ $.fn.extend({
|
|||
const handleClickMainImage = function handleClickMainImage(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const mainImageSrcExploded = e.target.src.split('/');
|
||||
|
||||
const thumbnails = $('[data-lightbox="sylius-product-image"]');
|
||||
if (thumbnails.length > 0) {
|
||||
thumbnails[0].click();
|
||||
}
|
||||
thumbnails.each((index, element) => {
|
||||
const imageSrcExploded = $(element).find('img').attr('src').split('/');
|
||||
if (mainImageSrcExploded[mainImageSrcExploded.length - 1] === imageSrcExploded[imageSrcExploded.length - 1]) {
|
||||
element.click();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const mainImage = $('#main-image');
|
||||
const mainImage = $('a.ui.fluid.image > img');
|
||||
mainImage.click(handleClickMainImage);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
{% endif %}
|
||||
|
||||
<div data-product-image="{{ path }}" data-product-link="{{ original_path }}"></div>
|
||||
<a href="{{ original_path }}" class="ui fluid image">
|
||||
<a href="{{ original_path }}" class="ui fluid image"{% if product.images|length < 2%} data-lightbox="sylius-product-image"{% endif %}>
|
||||
<img src="{{ path }}" id="main-image" alt="{{ product.name }}" {{ sylius_test_html_attribute('main-image') }} />
|
||||
</a>
|
||||
{% if product.images|length > 1 %}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue