feat($ionicSlideBoxDelegate): add speed parameter to next()/previous()

Closes #3493.
This commit is contained in:
Andrew
2015-04-13 14:24:17 -06:00
parent 51f8f3cdf9
commit b3c086eb08
2 changed files with 9 additions and 7 deletions

View File

@@ -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',

View File

@@ -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);
}