From b3c086eb0847b8c4075b5cf808be4bb97f155e7d Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 13 Apr 2015 14:24:17 -0600 Subject: [PATCH] feat($ionicSlideBoxDelegate): add `speed` parameter to next()/previous() Closes #3493. --- js/angular/service/slideBoxDelegate.js | 4 +++- js/views/sliderView.js | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/js/angular/service/slideBoxDelegate.js b/js/angular/service/slideBoxDelegate.js index 586512dd330..156948f454c 100644 --- a/js/angular/service/slideBoxDelegate.js +++ b/js/angular/service/slideBoxDelegate.js @@ -48,7 +48,7 @@ IonicModule * @ngdoc method * @name $ionicSlideBoxDelegate#slide * @param {number} to The index to slide to. - * @param {number=} speed The number of milliseconds for the change to take. + * @param {number=} speed The number of milliseconds the change should take. */ 'slide', 'select', @@ -62,12 +62,14 @@ IonicModule /** * @ngdoc method * @name $ionicSlideBoxDelegate#previous + * @param {number=} speed The number of milliseconds the change should take. * @description Go to the previous slide. Wraps around if at the beginning. */ 'previous', /** * @ngdoc method * @name $ionicSlideBoxDelegate#next + * @param {number=} speed The number of milliseconds the change should take. * @description Go to the next slide. Wraps around if at the end. */ 'next', diff --git a/js/views/sliderView.js b/js/views/sliderView.js index fedd82e9379..c98fde2a0c5 100644 --- a/js/views/sliderView.js +++ b/js/views/sliderView.js @@ -93,17 +93,17 @@ ionic.views.Slider = ionic.views.View.inherit({ options.slidesChanged && options.slidesChanged(); } - function prev() { + function prev(slideSpeed) { - if (options.continuous) slide(index-1); - else if (index) slide(index-1); + if (options.continuous) slide(index-1, slideSpeed); + else if (index) slide(index-1, slideSpeed); } - function next() { + function next(slideSpeed) { - if (options.continuous) slide(index+1); - else if (index < slides.length - 1) slide(index+1); + if (options.continuous) slide(index+1, slideSpeed); + else if (index < slides.length - 1) slide(index+1, slideSpeed); }