Slides - how to disable swipe between slides (with gestures)?


Do you know any solutions? I need to allow only change slides using:


You can disable swipe gestures by passing options to the slider:

<ion-slides class="slides" [options]="{onlyExternal: false}">
    <p>First Slide</p>
    <p>Second Slide</p>

Here you can find more options:

Does anyone know how to access the slider object?


Thanks for reply!

Getting access the slider object is here


Not directly an answer to your use case but just in case someone is wondering. In order to disable/enable swiping of slides dynamically I had to use the following:

>     let swiperInstance = this.slider.getSlider();
>     if (shouldSwipe == true){
>       swiperInstance.unlockSwipes();`
>     } else {
>       swiperInstance.lockSwipes();
>     }

according to SwiperAPI and Slides - Ionic API


lockSwipes() should do the job

This how i managed the lock
next() { if (!this.editMode) { this.signupSlider.lockSwipes(false) this.signupSlider.slideNext(); this.signupSlider.lockSwipes(true) } else { this.signupSlider.slideNext(); } }


[options]="{onlyExternal: false}"

This option didn’t work for me.


Please help me not working for me as well


unexpected token. please help


Looking at the Swiper API, you can add the noSwipingClass to your options.


scope.options = {
	loop: false,
	noSwipingClass: 'swiper-no-swiping',
	effect: 'slide',
	speed: 500

Assuming you’re using ionic v1, you can then just add the specified class to your ion-slide-page.

<ion-slide-page class="swiper-no-swiping">


Class works for ionic v2+ as well


<ion-slide-page class=“swiper-no-swiping”>



this.slides.lockSwipes(true); // this will disable the swipe in either ways
this.slides.lockSwipes(false); // this will enable the swipe in either ways


Simplest answer here, works a charm, thanks!


How could I lock the swipe in one direction? It does not work out for me dynamically - only once I pass it to the options static…

Thanks, Olli