@@ -309,8 +309,9 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
309
309
removeAfterAnimate ( modalWindow . modalDomEl , modalWindow . modalScope , function ( ) {
310
310
var modalBodyClass = modalWindow . openedClass || OPENED_MODAL_CLASS ;
311
311
openedClasses . remove ( modalBodyClass , modalInstance ) ;
312
- appendToElement . toggleClass ( modalBodyClass , openedClasses . hasKey ( modalBodyClass ) ) ;
313
- if ( scrollbarPadding && scrollbarPadding . heightOverflow && scrollbarPadding . scrollbarWidth ) {
312
+ var areAnyOpen = openedClasses . hasKey ( modalBodyClass ) ;
313
+ appendToElement . toggleClass ( modalBodyClass , areAnyOpen ) ;
314
+ if ( ! areAnyOpen && scrollbarPadding && scrollbarPadding . heightOverflow && scrollbarPadding . scrollbarWidth ) {
314
315
if ( scrollbarPadding . originalRight ) {
315
316
appendToElement . css ( { paddingRight : scrollbarPadding . originalRight + 'px' } ) ;
316
317
} else {
@@ -444,7 +445,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
444
445
modalBodyClass = modal . openedClass || OPENED_MODAL_CLASS ;
445
446
446
447
toggleTopWindowClass ( false ) ;
447
-
448
+
448
449
// Store the current top first, to determine what index we ought to use
449
450
// for the current top modal
450
451
previousTopOpenedModal = openedWindows . top ( ) ;
@@ -482,6 +483,10 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
482
483
}
483
484
$compile ( backdropDomEl ) ( backdropScope ) ;
484
485
$animate . enter ( backdropDomEl , appendToElement ) ;
486
+ scrollbarPadding = $uibPosition . scrollbarPadding ( appendToElement ) ;
487
+ if ( scrollbarPadding . heightOverflow && scrollbarPadding . scrollbarWidth ) {
488
+ appendToElement . css ( { paddingRight : scrollbarPadding . right + 'px' } ) ;
489
+ }
485
490
}
486
491
487
492
// Set the top modal index based on the index of the previous top modal
@@ -499,10 +504,6 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
499
504
angularDomEl . attr ( 'modal-animation' , 'true' ) ;
500
505
}
501
506
502
- scrollbarPadding = $uibPosition . scrollbarPadding ( appendToElement ) ;
503
- if ( scrollbarPadding . heightOverflow && scrollbarPadding . scrollbarWidth ) {
504
- appendToElement . css ( { paddingRight : scrollbarPadding . right + 'px' } ) ;
505
- }
506
507
appendToElement . addClass ( modalBodyClass ) ;
507
508
$animate . enter ( $compile ( angularDomEl ) ( modal . scope ) , appendToElement ) ;
508
509
0 commit comments