This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree 1 file changed +16
-15
lines changed
1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -45,26 +45,27 @@ angular.module('ui.bootstrap.collapse',['ui.bootstrap.transition'])
45
45
return currentTransition ;
46
46
} ;
47
47
48
- var expand = function ( ) {
48
+ var expand = function ( ) {
49
+ isCollapsed = false ;
49
50
if ( initialAnimSkip ) {
50
51
initialAnimSkip = false ;
51
- if ( ! isCollapsed ) {
52
- fixUpHeight ( scope , element , 'auto' ) ;
53
- element . addClass ( 'in' ) ;
54
- }
52
+ expandDone ( ) ;
55
53
} else {
56
- doTransition ( { height : element [ 0 ] . scrollHeight + 'px' } )
57
- . then ( function ( ) {
58
- // This check ensures that we don't accidentally update the height if the user has closed
59
- // the group while the animation was still running
60
- if ( ! isCollapsed ) {
61
- fixUpHeight ( scope , element , 'auto' ) ;
62
- element . addClass ( 'in' ) ;
63
- }
64
- } ) ;
54
+ var targetElHeight = element [ 0 ] . scrollHeight ;
55
+ if ( targetElHeight ) {
56
+ doTransition ( { height : targetElHeight + 'px' } ) . then ( expandDone ) ;
57
+ } else {
58
+ expandDone ( ) ;
59
+ }
65
60
}
66
- isCollapsed = false ;
67
61
} ;
62
+
63
+ function expandDone ( ) {
64
+ if ( ! isCollapsed ) {
65
+ fixUpHeight ( scope , element , 'auto' ) ;
66
+ element . addClass ( 'in' ) ;
67
+ }
68
+ }
68
69
69
70
var collapse = function ( ) {
70
71
isCollapsed = true ;
You can’t perform that action at this time.
0 commit comments