Skip to content
This repository was archived by the owner on May 10, 2018. It is now read-only.

Commit d2a7fe9

Browse files
author
Julien Bouquillon
committed
Merge pull request #317 from big-data-labs/master
End to End Swiping & Set of images
2 parents 9f4e93d + 06d7779 commit d2a7fe9

File tree

4 files changed

+126
-6
lines changed

4 files changed

+126
-6
lines changed

dist/angular-carousel.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Angular Carousel - Mobile friendly touch carousel for AngularJS
3-
* @version v0.3.10 - 2015-02-11
3+
* @version v0.3.10 - 2015-04-16
44
* @link http://revolunet.github.com/angular-carousel
55
* @author Julien Bouquillon <julien@revolunet.com>
66
* @license MIT License, http://www.opensource.org/licenses/MIT
@@ -486,7 +486,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
486486
scope.$parent.$watch(indexModel, function(newValue, oldValue) {
487487

488488
if (newValue !== undefined && newValue !== null) {
489-
if (currentSlides && newValue >= currentSlides.length) {
489+
if (currentSlides && currentSlides.length > 0 && newValue >= currentSlides.length) {
490490
newValue = currentSlides.length - 1;
491491
updateParentIndex(newValue);
492492
} else if (currentSlides && newValue < 0) {
@@ -548,6 +548,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
548548
function swipeEnd(coords, event, forceAnimation) {
549549
// console.log('swipeEnd', 'scope.carouselIndex', scope.carouselIndex);
550550
// Prevent clicks on buttons inside slider to trigger "swipeEnd" event on touchend/mouseup
551+
// console.log(iAttributes.rnCarouselOnInfiniteScroll);
551552
if (event && !swipeMoved) {
552553
return;
553554
}
@@ -575,10 +576,19 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
575576
slidesMove = -scope.carouselIndex;
576577
}
577578
var moveOffset = shouldMove ? slidesMove : 0;
578-
579+
579580
destination = (scope.carouselIndex + moveOffset);
580581

581582
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+
582592
} else {
583593
scope.$apply(function() {
584594
scope.carouselIndex = parseInt(-offset / 100, 10);

0 commit comments

Comments
 (0)