From 2b6970d33afd75be5bfef951dc3691d492004d43 Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Tue, 18 Apr 2023 01:11:37 +0300 Subject: admin back-office environment (skeleton); admin categories --- .../js/_dependency-control/plugins/gallery.js | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 public/assets/js/_dependency-control/plugins/gallery.js (limited to 'public/assets/js/_dependency-control/plugins/gallery.js') diff --git a/public/assets/js/_dependency-control/plugins/gallery.js b/public/assets/js/_dependency-control/plugins/gallery.js new file mode 100644 index 0000000..6ac147a --- /dev/null +++ b/public/assets/js/_dependency-control/plugins/gallery.js @@ -0,0 +1,51 @@ +$$plugins.define('gallery', ['swiper-bundle', 'domHelper'], function (element, options, Swiper, $) { + var $galleryImg = $('.gallery__figure img'), + thumbs = document.querySelector('.galleryThumbs'), + sliderModal = document.querySelector('.gallerySliderModal'), + $image; + + var swiperThumbs = new Swiper(".galleryThumbs", { + direction: "horizontal", + freeMode: true, + init: false, + slidesPerView: 4, + spaceBetween: 8, + speed: 800, + watchSlidesProgress: true, + pagination: { + el: '.swiper-pagination', + }, + breakpoints: { + 768: { + slidesPerView: 5, + spaceBetween: 17, + } + }, + }); + + var swiperMain = new Swiper(".galleryMainImg", { + init: false, + loop: true, + navigation: { + nextEl: ".swiper-button-next", + prevEl: ".swiper-button-prev", + }, + speed: 800, + thumbs: { + swiper: swiperThumbs, + }, + }); + + $galleryImg.on('click', function () { + if (!thumbs.classList.contains('swiper-initialized')) { + swiperThumbs.init(); + swiperMain.init(); + } + sliderModal.classList.add('open'); + $image = $(this).parents('.gallery__figure'); + swiperMain.slideTo($image.index() + 1, 0); + + //document.documentElement.classList.add('noScroll'); + + }); +}); \ No newline at end of file -- cgit v1.2.3