Swiper Touch Events - Enable click but disable drag

Mladen Janjetovic picture Mladen Janjetovic · May 22, 2017 · Viewed 19.7k times · Source

I am using Swiper 3.4.2 slider with thumbs as a pagination slider. And I need to disable drag on the pagination slider but to enable click events so the main slider can be changed by clicking on thumbs in the pagination slider.

    var galleryThumbs = new Swiper('.gallery-thumbs', {
        spaceBetween: 0,
        slidesPerView: 'auto',
        shortSwipes: false,
        slideToClickedSlide: true,
        preventClicksPropagation: false,
        preventClicks: false
    });

By setting simulateTouch to false, I am loosing the click touch event also.

Answer

Mladen Janjetovic picture Mladen Janjetovic · May 22, 2017

Setting the touchRatio: 0 will disable the drag touch event and leave the click touch event enabled

Update from v4

allowTouchMove: false,