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

Option to customize value of transition duration during swipe. #394

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ angular.module('MyApp', ['angular-carousel']);
library](https://github.com/jeremyckahn/shifty/blob/master/src/shifty.formulas.js) (default=easeIn)
- `rn-carousel-duration`: add this attribute to set the duration of the transition (default=300)
- `rn-carousel-controls-allow-loop`: add this attribute to allow looping through slides from prev/next controls
- `rn-carousel-swipe-transition-duration`: add this attribute to set the duration of the transition for swipe actions (if not given default carousel transition duration is taken)

## Indicators

Expand Down
13 changes: 7 additions & 6 deletions dist/angular-carousel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Angular Carousel - Mobile friendly touch carousel for AngularJS
* @version v1.0.1 - 2016-03-05
* @version v1.0.1 - 2016-03-18
* @link http://revolunet.github.com/angular-carousel
* @author Julien Bouquillon <[email protected]>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -267,6 +267,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
transitionType: iAttributes.rnCarouselTransition || 'slide',
transitionEasing: iAttributes.rnCarouselEasing || 'easeTo',
transitionDuration: parseInt(iAttributes.rnCarouselDuration, 10) || 300,
swipeTransitionDuration: parseInt(iAttributes.rnCarouselSwipeTransitionDuration, 10) || false,
isSequential: true,
autoSlideDuration: 3,
bufferSize: 5,
Expand Down Expand Up @@ -346,7 +347,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
goToSlide(index, slideOptions);
};

function goToSlide(index, slideOptions) {
function goToSlide(index, slideOptions, isSwipe) {
//console.log('goToSlide', arguments);
// move a to the given slide index
if (index === undefined) {
Expand All @@ -371,7 +372,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
to: {
'x': index * -100
},
duration: options.transitionDuration,
duration: (isSwipe && options.swipeTransitionDuration ? options.swipeTransitionDuration : options.transitionDuration),
easing: options.transitionEasing,
step: function(state) {
if (isFinite(state.x)) {
Expand Down Expand Up @@ -599,14 +600,14 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach

destination = (scope.carouselIndex + moveOffset);

goToSlide(destination);
goToSlide(destination, {}, 1);
if(iAttributes.rnCarouselOnInfiniteScrollRight!==undefined && slidesMove === 0 && scope.carouselIndex !== 0) {
$parse(iAttributes.rnCarouselOnInfiniteScrollRight)(scope)
goToSlide(0);
goToSlide(0, {}, 1);
}
if(iAttributes.rnCarouselOnInfiniteScrollLeft!==undefined && slidesMove === 0 && scope.carouselIndex === 0 && moveOffset === 0) {
$parse(iAttributes.rnCarouselOnInfiniteScrollLeft)(scope)
goToSlide(currentSlides.length);
goToSlide(currentSlides.length, {}, 1);
}

} else {
Expand Down
Loading