Задать вопрос
Ответы пользователя по тегу JavaScript
  • Как на странице менять высоту слайда Swiper?

    leotoleo
    @leotoleo Автор вопроса
    Верстаю на html css js
    Вопрос решил таким кодом:
    new Swiper(".swiper-date", {
      autoHeight: true,
      navigation: {
        nextEl: ".btn-date_next",
        prevEl: ".btn-date_prev",
      },
      breakpoints: {
          320: {
              spaceBetween: 20,
          },
          768: {
              spaceBetween: 20,
          }
      }
    });
    
    const swipersDate = document.querySelectorAll('.swiper-date');
    
    swipersDate.forEach(swiperDate => {
      const swiperItem = swiperDate.swiper;
    
      setInterval(() => {
        swiperItem.update();
      }, 100)
    })
    Ответ написан
    Комментировать