|
1 | 1 | /** |
2 | 2 | * Angular Carousel - Mobile friendly touch carousel for AngularJS |
3 | | - * @version v0.3.10 - 2015-02-11 |
| 3 | + * @version v0.3.10 - 2015-04-16 |
4 | 4 | * @link http://revolunet.github.com/angular-carousel |
5 | 5 | * @author Julien Bouquillon <julien@revolunet.com> |
6 | 6 | * @license MIT License, http://www.opensource.org/licenses/MIT |
@@ -486,7 +486,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach |
486 | 486 | scope.$parent.$watch(indexModel, function(newValue, oldValue) { |
487 | 487 |
|
488 | 488 | if (newValue !== undefined && newValue !== null) { |
489 | | - if (currentSlides && newValue >= currentSlides.length) { |
| 489 | + if (currentSlides && currentSlides.length > 0 && newValue >= currentSlides.length) { |
490 | 490 | newValue = currentSlides.length - 1; |
491 | 491 | updateParentIndex(newValue); |
492 | 492 | } else if (currentSlides && newValue < 0) { |
@@ -548,6 +548,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach |
548 | 548 | function swipeEnd(coords, event, forceAnimation) { |
549 | 549 | // console.log('swipeEnd', 'scope.carouselIndex', scope.carouselIndex); |
550 | 550 | // Prevent clicks on buttons inside slider to trigger "swipeEnd" event on touchend/mouseup |
| 551 | + // console.log(iAttributes.rnCarouselOnInfiniteScroll); |
551 | 552 | if (event && !swipeMoved) { |
552 | 553 | return; |
553 | 554 | } |
@@ -575,10 +576,19 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach |
575 | 576 | slidesMove = -scope.carouselIndex; |
576 | 577 | } |
577 | 578 | var moveOffset = shouldMove ? slidesMove : 0; |
578 | | - |
| 579 | + |
579 | 580 | destination = (scope.carouselIndex + moveOffset); |
580 | 581 |
|
581 | 582 | goToSlide(destination); |
| 583 | + if(iAttributes.rnCarouselOnInfiniteScrollRight!==undefined && slidesMove === 0 && scope.carouselIndex !== 0) { |
| 584 | + $parse(iAttributes.rnCarouselOnInfiniteScrollRight)(scope) |
| 585 | + goToSlide(0); |
| 586 | + } |
| 587 | + if(iAttributes.rnCarouselOnInfiniteScrollLeft!==undefined && slidesMove === 0 && scope.carouselIndex === 0 && moveOffset === 0) { |
| 588 | + $parse(iAttributes.rnCarouselOnInfiniteScrollLeft)(scope) |
| 589 | + goToSlide(currentSlides.length); |
| 590 | + } |
| 591 | + |
582 | 592 | } else { |
583 | 593 | scope.$apply(function() { |
584 | 594 | scope.carouselIndex = parseInt(-offset / 100, 10); |
|
0 commit comments