Skip to content

Commit

Permalink
reply on parent element instead of media id to toggle spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
metamoni committed Feb 23, 2023
1 parent b7f7b67 commit 72aa630
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion assets/magnify.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function prepareOverlay(container, image) {
}

function toggleLoadingSpinner(image) {
const loadingSpinner = document.getElementById(`loading-spinner-${image.dataset.mediaId}`);
const loadingSpinner = image.parentElement.parentElement.querySelector(`.loading-overlay__spinner`);
loadingSpinner.classList.toggle('hidden');
}

Expand Down
6 changes: 0 additions & 6 deletions assets/section-main-product.css
Original file line number Diff line number Diff line change
Expand Up @@ -1468,12 +1468,6 @@ a.product__text {
position: relative;
}

.product__modal-opener {
display: flex;
justify-content: center;
align-items: center;
}

@media screen and (min-width: 750px) {
.product-media-container .product__modal-opener:not(.product__modal-opener--image) {
display: none;
Expand Down
3 changes: 1 addition & 2 deletions snippets/product-thumbnail.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
endcase
-%}
</span>
<div class="loading-overlay__spinner hidden" id="loading-spinner-{{ media.id }}">
<div class="loading-overlay__spinner hidden">
<svg
aria-hidden="true"
focusable="false"
Expand All @@ -106,7 +106,6 @@
class: image_class,
loading: lazy,
sizes: sizes,
data-media-id: media.id,
widths: '246, 493, 600, 713, 823, 990, 1100, 1206, 1346, 1426, 1646, 1946'
}}
</div>
Expand Down

0 comments on commit 72aa630

Please sign in to comment.