From 61a20ea70e4b7187b86030dd1a76781d0fb16021 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Mon, 8 Jun 2015 12:49:40 -0500 Subject: [PATCH] Non-continuous slide fix --- ionic/components/slides/slides.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/ionic/components/slides/slides.js b/ionic/components/slides/slides.js index 4eba5f05af..bced166245 100644 --- a/ionic/components/slides/slides.js +++ b/ionic/components/slides/slides.js @@ -225,14 +225,34 @@ export class Slides { * Slide left, possibly wrapping around in continuous mode. */ prev() { - this.slide(this.currentIndex - 1); + if(this.continuous) { + + // Always allow us to go back + this.slide(this.currentIndex - 1); + + } else if(this.currentIndex > 0) { + + // If we have one slide to the left + this.slide(this.currentIndex - 1); + + } } /** * Slide right, possibly wrapping around in continuous mode. */ next() { - this.slide(this.currentIndex + 1); + if(this.continuous) { + + // Always allow us to go next + this.slide(this.currentIndex + 1); + + } else if(this.currentIndex < this.slides.length - 1) { + + // If not in continuous mode, only slide if we have a right slide + this.slide(this.currentIndex + 1); + + } }