bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Carousel strange transition [bootstrap 3]

Open djordje opened this issue 13 years ago • 42 comments

I've made video that show behaviour (angular 1.2.3).

https://dl.dropboxusercontent.com/u/21598387/AngularUI_Bootstrap3_carousel.mov

djordje avatar Dec 04 '13 18:12 djordje

@djordje what is the version of this library that you are using? Please note that BS3 support is only available in the development branch (bootstrap3).

pkozlowski-opensource avatar Dec 04 '13 18:12 pkozlowski-opensource

Latest bootstrap3 branch - d7c69d462f

djordje avatar Dec 05 '13 09:12 djordje

Yep. I can confirm this behaviour. It happens only when ngAnimate module is loaded. Tested with angular 1.2.3 & bootstrap3 d7c69d4.

sudhakar avatar Dec 09 '13 11:12 sudhakar

I can confirm that its about ngAnimate. (bs3, angular 1.2.0)

AttilaSATAN avatar Dec 11 '13 13:12 AttilaSATAN

I found work around: http://plnkr.co/edit/8HfZCaTOIeAesKVFSFpj?p=preview

djordje avatar Dec 11 '13 17:12 djordje

@djordje ty very much it realy saves so much of my time.

AttilaSATAN avatar Dec 12 '13 08:12 AttilaSATAN

First to create a directive as following :

app.directive('disableAnimation', function($animate){
    return {
        restrict: 'A',
        link: function($scope, $element, $attrs){
            $attrs.$observe('disableAnimation', function(value){
                $animate.enabled(!value, $element);
            });
        }
    }
});

Given that your app have already declared 'ngAnimate' as dependency. Then, create the following HTML code, and it should work

<carousel interval="5000" disable-animation="true">
  <slide ng-repeat="slide in slides">
    <img ng-src="{{slide.image}}" width="1000" height="300" style="margin:auto;">
  </slide>
</carousel>

@djordje

simonykq avatar Feb 10 '14 01:02 simonykq

Hmm, seems like this is still a problem with the latest release of AngularJS: http://plnkr.co/edit/Xl5Ok6UOJFAuZyTxO39F?p=preview

pkozlowski-opensource avatar Feb 15 '14 09:02 pkozlowski-opensource

@djordje - great workaround, thanks a lot.

eliranmal avatar Mar 01 '14 16:03 eliranmal

Workaround works, thanks.

But could you please fix this? It still exists in AngularJS 1.2.14.

I've modified your example code: http://plnkr.co/edit/PKiOP8D4vPnVy8wNOidO

Thank you!

sandersietses avatar Mar 05 '14 15:03 sandersietses

@Aldentev That is going to be fixed on the next version.

Foxandxss avatar Mar 05 '14 17:03 Foxandxss

This still happens in 1.2.16

jkimvital avatar Apr 22 '14 16:04 jkimvital

Yep... still happening in 1.2.16. :worried:

Thanks @simonykq... your workaround is nice.

leniel avatar May 20 '14 01:05 leniel

duplicate issue #1273

iamlothian avatar May 21 '14 03:05 iamlothian

@simonykq :+1:

I refactored simonykq's solution, because I just wanted to disable ng-animate (never explicitly enable it) to get <carousel> to work. I also made the code minification safe and "optimized" the link function by dropping the unused $attrs parameter.

CoffeeScript:

app.directive 'disableNgAnimate', ['$animate', ($animate)->
  restrict: 'A'
  link: (scope, element)-> $animate.enabled false, element
]

JavaScript:

app.directive('disableNgAnimate', ['$animate', function($animate) {
  return {
    restrict: 'A',
    link: function(scope, element) {
      $animate.enabled(false, element);
    }
  };
}]);

Use:

<carousel disable-ng-animate>
  ...
</carousel>

whitehat101 avatar May 29 '14 06:05 whitehat101

I'm currently using Angular-Bootstrap v0.11.0 and Angular.js v1.2.19. I've tried disabling ngAnimate entirely and the workaround Directive that selectively disables ngAnimate, but I can't get the carousel to work. The slide classes don't update when they try to transition, so slide 1 has the following classes: item text-center ng-isolate-scope active left and slide 2 has item text-center ng-isolate-scope next left and it remains stuck there. Nothing changes. The prev() and next() buttons also do nothing.

goodbomb avatar Jul 16 '14 22:07 goodbomb

@simonykq thank you!

bang-dc avatar Jul 17 '14 06:07 bang-dc

@whitehat101. Yes yours is better. Many thanks

simonykq avatar Jul 17 '14 06:07 simonykq

@simonykq @whitehat101 Thanks for the solution.

skusunam avatar Jul 18 '14 06:07 skusunam

@simonykq @whitehat101 Thanks your solution works simple and neat. I am a newbie and I don't understand what this is really doing inside the carousel and outside it. Could you give me a quick explanation? If this is not really the place to ask then please forgive me and ignore.

davsantos avatar Sep 03 '14 09:09 davsantos