From 2e325b48394de183c3c81a7c76115613953f9f62 Mon Sep 17 00:00:00 2001 From: maksim Date: Sun, 8 Jun 2025 21:12:30 +0300 Subject: [PATCH] =?UTF-8?q?Task:=206607=20|=20=D0=9F=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BD=D0=B0=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/assets/css/gp-style-core.css | 85 -------------- .../modules/layout/assets/js/gp-main.js | 109 ++++++++++++++---- .../templates/front-page/front-page.twig | 107 ++++++++--------- 3 files changed, 134 insertions(+), 167 deletions(-) diff --git a/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css b/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css index ec42595..74411bd 100644 --- a/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css +++ b/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css @@ -2073,92 +2073,7 @@ textarea{ } } -.container, .container-fluid { - width: 100%; - padding-right: 15px; - padding-left: 15px; - margin-right: auto; - margin-left: auto; -} - -.about_slider .prev, .about_slider .next { - position: absolute; - top: 50%; - transform: translateY(-50%); - cursor: pointer; - z-index: 99; - background-color: unset; -} - -.about_slider .next { - right: 29vw; -} - -.about_slider .prev { - left: 29vw; -} - -.about_slider .carousel-item { - height: 546px; - padding: 35px 50px 25px 50px; - padding: 50px 53px; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - /* background: var(--creme-white, #F4F1F0); */ - background: #ffffff30; - backdrop-filter: blur(6px); - z-index: 1; - box-shadow: -2px 5px 22.9px 0px rgba(0, 0, 0, 0.25); -} - -.about_slider .swiper-slide-active { - backdrop-filter: blur(6px); - width: 429px!important; - z-index: 3; -} - -.about_slider .carousel-item img { - width: auto; -} -.about_slider .slide_info { - display: flex; - flex-direction: column; - gap: 15px; -} - -.about_slider .carousel-item::after { - content: ''; - background-image: url(/wp-content/themes/cosmopet/static/front-page/img/border.png); - background-size: cover; - /* background: linear-gradient(21.69deg, #F44242 23.69%, #569EF0 66.57%); */ - display: block; - position: absolute; - width: calc(100% + 4px); - height: calc(100% + 4px); - border-radius: 60px; - top: -2px; - left: -2px; - z-index: -2; - transform: translateZ(-1px); -} - -.about_slider .slide_title { - text-transform: uppercase; - font-size: 24px; - font-weight: 700; - line-height: 28.8px; - color: #121212; -} - -.about_slider .slide_text { - font-size: 20px; - font-weight: 500; - line-height: 24px; - color:#121212; -} .discount_block .discount_cosmodog { margin-top: 60px; 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 1419120..14643bb 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,35 +415,96 @@ if (document.querySelector('.header').classList.contains('white')) { // scroll document.addEventListener('DOMContentLoaded', function () { - /* start: aboutSlider */ - var slider = carousel_init(); - function carousel_init() { - var carousel = document.querySelectorAll('.carousel'); - if (window.innerWidth > 421) { - var options = { - numVisible: 5, - // indicators: true, + // Переводы для демонстрации + const translations = { + ru: { + 'slide1-title': 'МОС и ФОС пребиотики', + 'slide1-text': 'Поддерживают здоровый баланс микрофлоры кишечника и снижают риск заболеваний ЖКТ', + 'slide2-title': 'Омега 3 и жирные кислоты', + 'slide2-text': 'Улучшают работу мозга и сохраняют его активность, обеспечивают здоровье кожи и блеск шерсти', + 'slide3-title': 'Юкка Шидигера', + 'slide3-text': 'Стимулирует пищеварение, связывает вещества, вызывающие неприятный запах фекалий. Результат — регулярный стул с меньшим запахом', + 'slide4-title': 'Кальций, фосфор и витамин D', + 'slide4-text': 'В оптимальном соотношении поддерживают здоровье костей, способствуют восстановлению суставов и подвижности', + 'slide5-title': 'Энтопротеин', + 'slide5-text': 'Легкоперевариваемый энтопротеин, который к тому же превосходит по питательности традиционное мясо. Будучи новым источником белка, не вызывает аллергии у питомцев' + }, + ae: { + 'slide1-title': 'MOS and FOS prebiotics', + 'slide1-text': 'Maintain a healthy balance of intestinal microflora and reduces the risk of intestinal diseases', + 'slide2-title': 'Omega 3 and fatty acids', + 'slide2-text': 'They improve the functioning of the brain and maintain its normal activity, preserve the health of the skin and the shine of the coat', + 'slide3-title': 'Yucca schidigera', + 'slide3-text': 'It stimulates digestion, even binding the substances responsible for the specific smell of dog and cat faeces. As a result bowel-emptying occurs like clockwork (and with less odour!)', + 'slide4-title': 'Calcium, phosphorus and vitamin D', + 'slide4-text': 'In their optimal ratio, they support bone health, promote joint restoration and help maintain mobility', + 'slide5-title': 'E-protein', + 'slide5-text': 'An easily digestible E-protein, nutritionally superior to traditional meat; being a novel source of protein, does not cause allergies in pets' } - } else if (window.innerWidth < 421) { - var options = { - numVisible: 3, - // indicators: true, + }; + + function switchLanguage(lang) { + const texts = translations[lang]; + for (const [id, text] of Object.entries(texts)) { + const element = document.getElementById(id); + if (element) { + element.textContent = text; + } } } - var instances = M.Carousel.init(carousel, options); - document.querySelectorAll('.about_slider_nav').forEach(btn => { - btn.addEventListener('click', function (e) { - // window.t = e.target.closest('button') - // console.log(t) - if (e.target.closest('button').classList.contains('next')) { - instances[0].next(); - }else{ - instances[0].prev(); - } + + // Инициализация слайдера + var slider = carousel_init(); + + function carousel_init() { + var carousel = document.querySelectorAll('.carousel'); + var options; + + if (window.innerWidth > 421) { + options = { + numVisible: 5, + shift: 50, + dist: -50, + padding: 20 + }; + } else { + options = { + numVisible: 3, + shift: 30, + dist: -30, + padding: 10 + }; + } + + var instances = M.Carousel.init(carousel, options); + + // Обработчики для кнопок навигации + document.querySelectorAll('.about_slider_nav').forEach(btn => { + btn.addEventListener('click', function (e) { + if (e.target.closest('button').classList.contains('next')) { + instances[0].next(); + } else { + instances[0].prev(); + } + }); }); + + return instances; + } + + // Переинициализация при изменении размера экрана + window.addEventListener('resize', function() { + // Уничтожаем текущий экземпляр + var currentCarousel = M.Carousel.getInstance(document.querySelector('.carousel')); + if (currentCarousel) { + currentCarousel.destroy(); + } + + // Создаем новый с обновленными параметрами + setTimeout(() => { + slider = carousel_init(); + }, 100); }); - return instances; - } }); diff --git a/wp-content/themes/cosmopet/templates/front-page/front-page.twig b/wp-content/themes/cosmopet/templates/front-page/front-page.twig index 20133d3..28643a5 100644 --- a/wp-content/themes/cosmopet/templates/front-page/front-page.twig +++ b/wp-content/themes/cosmopet/templates/front-page/front-page.twig @@ -95,72 +95,63 @@ {% endif %}
-
- - -