Skip to content

Commit

Permalink
feat($ionicSlideBoxDelegate): add speed parameter to next()/previous()
Browse files Browse the repository at this point in the history
Closes #3493.
  • Loading branch information
ajoslin committed Apr 13, 2015
1 parent 51f8f3c commit b3c086e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion js/angular/service/slideBoxDelegate.js
Expand Up @@ -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',
Expand All @@ -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',
Expand Down
12 changes: 6 additions & 6 deletions js/views/sliderView.js
Expand Up @@ -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);

}

Expand Down

0 comments on commit b3c086e

Please sign in to comment.