Fix скрипта слайдера новой страницы

pull/36/head
parent 3d7dbe3012
commit 48fccdc5e4
  1. 17
      wp-content/themes/cosmopet/static/js/new-front-page.js

@ -257,7 +257,7 @@ document.addEventListener('DOMContentLoaded', function() {
// Gallery slider
const mosaicSwiper = new Swiper('.mosaic-swiper', {
const mosaicswiper = new Swiper('.mosaic-swiper', {
slidesPerView: 'auto',
spaceBetween: 20,
freeMode: true,
@ -265,21 +265,6 @@ document.addEventListener('DOMContentLoaded', function() {
loop: true // Включает бесконечную прокрутку
});
let scrollPosition = 0;
const speed = 0.2; // Очень медленная скорость в пикселях за кадр
function animate() {
scrollPosition -= speed;
swiper.wrapperEl.style.transform = `translateX(${scrollPosition}px)`;
// Корректировка для бесконечной прокрутки (простая имитация)
if (Math.abs(scrollPosition) > swiper.wrapperEl.scrollWidth / 2) {
scrollPosition = 0; // Сброс позиции для имитации бесконечности
}
requestAnimationFrame(animate);
}
animate();
// Quiz
const truthContents = document.querySelectorAll('.truth_content');
let currentIndex = 0;

Loading…
Cancel
Save