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

Commit

Permalink
fix(carousel): fix animation direction
Browse files Browse the repository at this point in the history
- Properly fix the animation direction of the slides

Closes #4092
Fixes #4087
  • Loading branch information
wesleycho committed Aug 4, 2015
1 parent 3584061 commit 8359d73
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/carousel/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ angular.module('ui.bootstrap.carousel', [])
if ($animate.enabled() && !$scope.noTransition && !$scope.$currentTransition &&
slide.$element) {
slide.$element.data(SLIDE_DIRECTION, slide.direction);
if (self.currentSlide && self.currentSlide.$element) {
self.currentSlide.$element.data(SLIDE_DIRECTION, slide.direction);
}

$scope.$currentTransition = true;
if (ANIMATE_CSS) {
$animate.on('addClass', slide.$element, function (element, phase) {
$scope.$currentTransition = null;
if (!$scope.$currentTransition) {
if (phase === 'close') {
$scope.$currentTransition = null;
$animate.off('addClass', element);
}
});
Expand Down Expand Up @@ -157,12 +161,6 @@ angular.module('ui.bootstrap.carousel', [])
};

self.addSlide = function(slide, element) {
// add default direction for initial transition
// necessary for angular 1.4+
if (!slides.length && element) {
element.data(SLIDE_DIRECTION, 'next');
}

slide.$element = element;
slides.push(slide);
//if this is the first slide or the slide is set to active, select it
Expand Down

0 comments on commit 8359d73

Please sign in to comment.