@@ -24,7 +24,7 @@ define([
24
24
* Detect browser transition end event.
25
25
* @return {String|undefined } - transition event.
26
26
*/
27
- var transitionEvent = ( function ( ) {
27
+ var transitionEvent = ( function ( ) {
28
28
var transition ,
29
29
elementStyle = document . createElement ( 'div' ) . style ,
30
30
transitions = {
@@ -39,7 +39,39 @@ define([
39
39
return transitions [ transition ] ;
40
40
}
41
41
}
42
- } ) ( ) ;
42
+ } ) ( ) ,
43
+
44
+ /**
45
+ * Implementation of zIndex used from jQuery UI
46
+ * @param {Element } elem
47
+ * @private
48
+ */
49
+ getZIndex = function ( elem ) {
50
+ var position , zIndex ;
51
+
52
+ /* eslint-disable max-depth */
53
+ while ( elem . length && elem [ 0 ] !== document ) {
54
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
55
+ // This makes behavior of this function consistent across browsers
56
+ // WebKit always returns auto if the element is positioned
57
+ position = elem . css ( 'position' ) ;
58
+
59
+ if ( position === 'absolute' || position === 'relative' || position === 'fixed' ) {
60
+ // IE returns 0 when zIndex is not specified
61
+ // other browsers return a string
62
+ // we ignore the case of nested elements with an explicit value of 0
63
+ zIndex = parseInt ( elem . css ( 'zIndex' ) , 10 ) ;
64
+
65
+ if ( ! isNaN ( zIndex ) && zIndex !== 0 ) {
66
+ return zIndex ;
67
+ }
68
+ }
69
+ elem = elem . parent ( ) ;
70
+ }
71
+
72
+ return 0 ;
73
+ /* eslint-enable max-depth */
74
+ } ;
43
75
44
76
/**
45
77
* Modal Window Widget
@@ -341,18 +373,17 @@ define([
341
373
* Set z-index and margin for modal and overlay.
342
374
*/
343
375
_setActive : function ( ) {
344
- var zIndex = this . modal . zIndex ( ) ,
376
+ var zIndex = getZIndex ( this . modal ) ,
345
377
baseIndex = zIndex + this . _getVisibleCount ( ) ;
346
378
347
379
if ( this . modal . data ( 'active' ) ) {
348
380
return ;
349
381
}
350
-
351
382
this . modal . data ( 'active' , true ) ;
352
383
353
- this . overlay . zIndex ( ++ baseIndex ) ;
354
- this . prevOverlayIndex = this . overlay . zIndex ( ) ;
355
- this . modal . zIndex ( this . overlay . zIndex ( ) + 1 ) ;
384
+ this . overlay . css ( 'z-index' , ++ baseIndex ) ;
385
+ this . prevOverlayIndex = baseIndex ;
386
+ this . modal . css ( 'z-index' , baseIndex + 1 ) ;
356
387
357
388
if ( this . _getVisibleSlideCount ( ) ) {
358
389
this . modal . css ( 'marginLeft' , this . options . modalLeftMargin * this . _getVisibleSlideCount ( ) ) ;
@@ -367,7 +398,7 @@ define([
367
398
this . modal . data ( 'active' , false ) ;
368
399
369
400
if ( this . overlay ) {
370
- this . overlay . zIndex ( this . prevOverlayIndex - 1 ) ;
401
+ this . overlay . css ( 'z-index' , this . prevOverlayIndex - 1 ) ;
371
402
}
372
403
} ,
373
404
0 commit comments