S
S
Sergey2020-02-17 16:11:25
JavaScript
Sergey, 2020-02-17 16:11:25

Why doesn't Swiper swipe to the last slide?

There is a slider with cards. Must be looped. When you swipe, all the cards are pulled away, but when you release the mouse, everything goes back and does not move much. The same works for navigation. Although everything works in the opposite direction - the slides go one by one.

this.config = {
        slidesPerView: 'auto',
        loop: true,
        centeredSlides: true,

        breakpoints: {
          320: {
            slidesOffsetBefore: -380,
          },
          768: {
            slidesOffsetBefore: -344,
          },
          1280: {
            centeredSlides: false,
            slidesOffsetBefore: 0,
          }
        },
        navigation: {
          nextEl: '[data-best-materials-slider-right]',
          prevEl: '[data-best-materials-slider-left]'
        },
        pagination: this.pagination,
        init: false,
      };

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2020-02-20
@DaveGarrow

It turns out centeredSlides: false interferes. If you remove it and leave true, then everything is ok. Weird, maybe a conflict with slidesPerView...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question