amagtra
amagtra

Reputation: 45

When accordion is open or collapsed (transition ended)

is it possible to know or intercept when an accordion is open or closed with angular-ui-bootstrap, only when transition is ended?

So, when one accordion content is open i can refresh iScroll instance.

Upvotes: 2

Views: 1161

Answers (1)

vinhboy
vinhboy

Reputation: 8982

Looking at

https://github.com/angular-ui/bootstrap/blob/master/src/collapse/collapse.js

There does not seem to be any event triggered on collapseDone() or expandDone() that you can hook into.

The only way you can really do this is to watch when the class 'collapsing' exists (meaning collapsing is happening), then you know collapsing is over when that class goes away.

      $scope.$watch(function() {
        return $('.panel-collapse').hasClass('collapsing');
      }, function(status) {
        if ($scope.collapsing && !status) {
          console.log('done collapsing');
        }
        $scope.collapsing = status;
      });

Similar question: AngularJS - Find end of collapse animation

Upvotes: 3

Related Questions