Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add async product images load in modal window
Paweł Kowalewski9cfe4d951739
diff --git a/saleor/product/templates/product/details.html b/saleor/product/templates/product/details.htmlindex 2ac5e4f229..372688e05a 100644--- a/saleor/product/templates/product/details.html+++ b/saleor/product/templates/product/details.html@@ -103,16 +103,16 @@{% for image in images %}<div class="modal fade" id="modal-{{ forloop.counter }}"- tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">+ tabindex="-1" role="dialog" aria-labelledby="myModalLabel{{ forloop.counter }}" aria-hidden="true"><div class="modal-dialog modal-lg"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>- <h4 class="modal-title" id="myModalLabel">{{ product }}</h4>+ <h4 class="modal-title" id="myModalLabel{{ forloop.counter }}">{{ product }}</h4></div><div class="modal-body">- <img class="img-responsive" src="{{ MEDIA_URL }}{{ image.image }}" alt="">+ <img class="img-responsive" src="" data-src="{{ MEDIA_URL }}{{ image.image }}" alt=""></div></div></div>@@ -147,7 +147,8 @@<script>$(function() {var $carousel = $('.carousel'),- $items = $('.product-gallery-item');+ $items = $('.product-gallery-item'),+ $modal = $('.modal');$items.on('click', function(e) {if ($('.carousel').is(':visible')) {@@ -157,6 +158,13 @@$carousel.carousel(index);});++ $modal.on('show.bs.modal', function() {+ var $img = $(this).find('.modal-body img'),+ dataSrc = $img.attr('data-src');++ $img.attr('src', dataSrc);+ });});</script>{% endblock %}