Ionic 3 Slides Component - Implement next and previous button

Neotrixs picture Neotrixs · Aug 21, 2017 · Viewed 9.2k times · Source

I am new in IONIC 3, I try to implement Slider in my Ionic App and I try to Implement next and previous button for slide.

Like:

enter image description here

Please help me for its functionality.

Answer

Gabriel Lovetro picture Gabriel Lovetro · Aug 21, 2017

According to the official documentation here, you can call either the slideTo() or slideNext() methods. For example (taken from the official Ionic v2+ documentation):

this.slides.slideTo(2, 500);

This would take you to the third slide, with a transition time of 500ms.

For changing to the previous or next slide you could either use the slideNext() and slidePrev() functions or save an index for the current slide and simply increment or decrement it, while passing it as a parameter to the slideTo() function.