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

Commit

Permalink
fix(collapse): dont animate height changes from 0 to 0
Browse files Browse the repository at this point in the history
Closes #1424
  • Loading branch information
pkozlowski-opensource committed Dec 28, 2013
1 parent 70af344 commit 81e014a
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/collapse/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,27 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition'])
return currentTransition;
};

var expand = function() {
var expand = function () {
isCollapsed = false;
if (initialAnimSkip) {
initialAnimSkip = false;
if ( !isCollapsed ) {
fixUpHeight(scope, element, 'auto');
element.addClass('in');
}
expandDone();
} else {
doTransition({ height : element[0].scrollHeight + 'px' })
.then(function() {
// This check ensures that we don't accidentally update the height if the user has closed
// the group while the animation was still running
if ( !isCollapsed ) {
fixUpHeight(scope, element, 'auto');
element.addClass('in');
}
});
var targetElHeight = element[0].scrollHeight;
if (targetElHeight) {
doTransition({ height: targetElHeight + 'px' }).then(expandDone);
} else {
expandDone();
}
}
isCollapsed = false;
};

function expandDone() {
if ( !isCollapsed ) {
fixUpHeight(scope, element, 'auto');
element.addClass('in');
}
}

var collapse = function() {
isCollapsed = true;
Expand Down

0 comments on commit 81e014a

Please sign in to comment.