From 3f409eb20bbcf9ff52395f14cf3c2c51494965ce Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 20 Mar 2020 16:31:43 +0100 Subject: [PATCH] wip #3511 @0.5 --- package.json | 1 + resources/js/product-details.js | 13 ++++ .../styles/components/product-gallery.styl | 4 +- .../views/partials/product-gallery.blade.php | 66 ++++++++++--------- 4 files changed, 52 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index c93b589..edbcfb3 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "devDependencies": { "@trevoreyre/autocomplete-vue": "^2.0.2", "axios": "^0.18", + "blueimp-gallery": "^2.36.0", "browser-sync": "^2.26.5", "browser-sync-webpack-plugin": "2.0.1", "cash-dom": "^4.1.5", diff --git a/resources/js/product-details.js b/resources/js/product-details.js index 76f5aa5..e8c7162 100644 --- a/resources/js/product-details.js +++ b/resources/js/product-details.js @@ -18,3 +18,16 @@ tippy('[data-tooltip]', { } }, }); + +import blueimp from 'blueimp-gallery'; + +document.getElementById('product-gallery').onclick = function (event) { + event = event || window.event; + var target = event.target || event.srcElement, + link = target.src ? target.parentNode : target, + options = {index: link, event: event, closeOnSlideClick: true, carrousel: true}, + links = this.querySelectorAll('a.g'); + + blueimp(links, options); +}; + diff --git a/resources/styles/components/product-gallery.styl b/resources/styles/components/product-gallery.styl index 7e5f044..9b17a3f 100644 --- a/resources/styles/components/product-gallery.styl +++ b/resources/styles/components/product-gallery.styl @@ -1,7 +1,7 @@ .product-gallery &-main - @apply bg-white relative border-gray-100 border-4 pb-100p mb-4 cursor-zoom-in + @apply bg-white relative border-gray-100 border-4 pb-100p mb-4 cursor-zoom-in block &-main-image @apply absolute bg-contain bg-center bg-no-repeat @@ -11,7 +11,7 @@ left: 15% &-thumb - @apply w-full bg-center bg-cover border-4 border-grey-100 cursor-zoom-in + @apply w-full bg-center bg-cover border-4 border-grey-100 cursor-zoom-in block &-current @apply border-grey-300 diff --git a/resources/views/partials/product-gallery.blade.php b/resources/views/partials/product-gallery.blade.php index 2e665c8..fafe228 100644 --- a/resources/views/partials/product-gallery.blade.php +++ b/resources/views/partials/product-gallery.blade.php @@ -1,37 +1,43 @@ @php - $images=$product->getImagesData('images'); + $images = $product->getImagesData('images','',null,$product->getEntity()->image_alt); + array_shift($images); @endphp -