File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 5757 this . _openingTrigger = undefined ;
5858 this . $overlay = $ ( '<div class="modal-overlay"></div>' ) ;
5959
60- Modal . _increment ++ ;
6160 Modal . _count ++ ;
62- this . $overlay [ 0 ] . style . zIndex = 1000 + Modal . _increment * 2 ;
63- this . el . style . zIndex = 1000 + Modal . _increment * 2 + 1 ;
6461 this . _setupEventHandlers ( ) ;
6562 }
6663
278275 }
279276
280277 this . isOpen = true ;
278+ Modal . _modalsOpen ++ ;
279+
280+ // Set Z-Index based on number of currently open modals
281+ this . $overlay [ 0 ] . style . zIndex = 1000 + Modal . _modalsOpen * 2 ;
282+ this . el . style . zIndex = 1000 + Modal . _modalsOpen * 2 + 1 ;
281283
282284 // Set opening trigger, undefined indicates modal was opened by javascript
283285 this . _openingTrigger = ! ! $trigger ? $trigger [ 0 ] : undefined ;
311313 }
312314
313315 this . isOpen = false ;
316+ Modal . _modalsOpen -- ;
314317
315318 // Call onCloseStart callback
316319 if ( typeof ( this . options . onCloseStart ) === 'function' ) {
320323 this . el . classList . remove ( 'open' ) ;
321324
322325 // Enable body scrolling only if there are no more modals open.
323- if ( Modal . _count === 0 ) {
326+ if ( Modal . _modalsOpen === 0 ) {
324327 document . body . style . overflow = '' ;
325328 }
326329
339342 * @static
340343 * @memberof Modal
341344 */
342- Modal . _increment = 0 ;
345+ Modal . _modalsOpen = 0 ;
343346
344347 /**
345348 * @static
You can’t perform that action at this time.
0 commit comments