From 5095a305dce01bf76febab8ce1a289c9e9454973 Mon Sep 17 00:00:00 2001 From: maksim Date: Sun, 8 Jun 2025 17:25:12 +0300 Subject: [PATCH] =?UTF-8?q?Task:=206607=20|=20Fix:=20=D0=9F=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BA=D0=B8=20=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B9=20?= =?UTF-8?q?=D1=81=D0=BB=D0=B0=D0=B9=D0=B4=D0=B5=D1=80=D0=B0=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/layout/assets/js/gp-main.js | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js b/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js index 7cc2a7b..1419120 100644 --- a/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js +++ b/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js @@ -415,24 +415,34 @@ if (document.querySelector('.header').classList.contains('white')) { // scroll document.addEventListener('DOMContentLoaded', function () { - var carousels = document.querySelectorAll('.carousel'); - - if (carousels.length) { - var options = { - numVisible: window.innerWidth > 421 ? 5 : 3, - }; - var instances = M.Carousel.init(carousels, options); - - document.querySelectorAll('.about_slider_nav').forEach(function (btn) { + /* start: aboutSlider */ + var slider = carousel_init(); + function carousel_init() { + var carousel = document.querySelectorAll('.carousel'); + if (window.innerWidth > 421) { + var options = { + numVisible: 5, + // indicators: true, + } + } else if (window.innerWidth < 421) { + var options = { + numVisible: 3, + // indicators: true, + } + } + var instances = M.Carousel.init(carousel, options); + document.querySelectorAll('.about_slider_nav').forEach(btn => { btn.addEventListener('click', function (e) { - const instance = instances[0]; - if (btn.classList.contains('next')) { - instance.next(); - } else { - instance.prev(); + // window.t = e.target.closest('button') + // console.log(t) + if (e.target.closest('button').classList.contains('next')) { + instances[0].next(); + }else{ + instances[0].prev(); } }); }); + return instances; } });