splash27
splash27

Reputation: 2107

How to prevent swiping by dragging in idangero swiper?

I need to prevent swiping by dragging (mouse, fingers), but keep it when using pagination buttons and next or prev button.

Here is how I initialize it:

var pcSwiper = new Swiper('.swiper-container_pc', {
        direction: 'horizontal',
        slidesPerView: 'auto',
        spaceBetween: 20,
        nested: true
});

Upvotes: 0

Views: 2198

Answers (1)

splash27
splash27

Reputation: 2107

As I found out disableTouchControl method also disables mouse dragging (not only touch dragging). So, the name and description of this method are a little bit unclear, but it works.

pcSwiper.disableTouchControl();

Upvotes: 0

Related Questions