|
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-04 |
4 | 4 | * @link http://revolunet.github.com/angular-carousel
|
5 | 5 | * @author Julien Bouquillon <[email protected]>
|
6 | 6 | * @license MIT License, http://www.opensource.org/licenses/MIT
|
@@ -485,7 +485,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
|
485 | 485 | scope.$parent.$watch(indexModel, function(newValue, oldValue) {
|
486 | 486 |
|
487 | 487 | if (newValue !== undefined && newValue !== null) {
|
488 |
| - if (currentSlides && newValue >= currentSlides.length) { |
| 488 | + if (currentSlides && currentSlides.length > 0 && newValue >= currentSlides.length) { |
489 | 489 | newValue = currentSlides.length - 1;
|
490 | 490 | updateParentIndex(newValue);
|
491 | 491 | } else if (currentSlides && newValue < 0) {
|
@@ -547,6 +547,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
|
547 | 547 | function swipeEnd(coords, event, forceAnimation) {
|
548 | 548 | // console.log('swipeEnd', 'scope.carouselIndex', scope.carouselIndex);
|
549 | 549 | // Prevent clicks on buttons inside slider to trigger "swipeEnd" event on touchend/mouseup
|
| 550 | + // console.log(iAttributes.rnCarouselOnInfiniteScroll); |
550 | 551 | if (event && !swipeMoved) {
|
551 | 552 | return;
|
552 | 553 | }
|
@@ -574,10 +575,23 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
|
574 | 575 | slidesMove = -scope.carouselIndex;
|
575 | 576 | }
|
576 | 577 | var moveOffset = shouldMove ? slidesMove : 0;
|
| 578 | + |
| 579 | + console.log("scope.carouselIndex = " + scope.carouselIndex); |
| 580 | + console.log("moveOffset = " + moveOffset); |
| 581 | + console.log("slidesMove = " + slidesMove); |
577 | 582 |
|
578 | 583 | destination = (scope.carouselIndex + moveOffset);
|
579 | 584 |
|
580 | 585 | goToSlide(destination);
|
| 586 | + if(iAttributes.rnCarouselOnInfiniteScrollRight!==undefined && slidesMove === 0 && scope.carouselIndex !== 0) { |
| 587 | + eval("scope." + iAttributes.rnCarouselOnInfiniteScrollRight); |
| 588 | + goToSlide(0); |
| 589 | + } |
| 590 | + if(iAttributes.rnCarouselOnInfiniteScrollLeft!==undefined && slidesMove === 0 && scope.carouselIndex === 0 && moveOffset === 0) { |
| 591 | + eval("scope." + iAttributes.rnCarouselOnInfiniteScrollLeft); |
| 592 | + goToSlide(currentSlides.length); |
| 593 | + } |
| 594 | + |
581 | 595 | } else {
|
582 | 596 | scope.$apply(function() {
|
583 | 597 | scope.carouselIndex = parseInt(-offset / 100, 10);
|
|
0 commit comments