File tree Expand file tree Collapse file tree 2 files changed +43
-2
lines changed Expand file tree Collapse file tree 2 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 695
695
elementPosition = _getOffset ( currentElement . element ) ,
696
696
widthHeightPadding = 10 ;
697
697
698
+ // if the target element is fixed, the tooltip should be fixed as well.
699
+ if ( _isFixed ( currentElement . element ) ) {
700
+ helperLayer . className += ' introjs-fixedTooltip' ;
701
+ }
702
+
698
703
if ( currentElement . position == 'floating' ) {
699
704
widthHeightPadding = 0 ;
700
705
}
1067
1072
} else {
1068
1073
return propValue ;
1069
1074
}
1070
- }
1075
+ } ;
1076
+
1077
+ /**
1078
+ * Checks to see if target element (or parents) position is fixed or not
1079
+ *
1080
+ * @api private
1081
+ * @method _isFixed
1082
+ * @param {Object } element
1083
+ * @returns Boolean
1084
+ */
1085
+ function _isFixed ( element ) {
1086
+ var p = element . parentNode ;
1087
+
1088
+ if ( p . nodeName === 'HTML' ) {
1089
+ return false ;
1090
+ }
1091
+
1092
+ if ( _getPropValue ( element , 'position' ) == 'fixed' ) {
1093
+ return true ;
1094
+ }
1095
+
1096
+ return _isFixed ( p ) ;
1097
+ } ;
1071
1098
1072
1099
/**
1073
1100
* Provides a cross-browser way to get the screen dimensions
1336
1363
} ( hint , item , i ) ) ;
1337
1364
1338
1365
hint . className = 'introjs-hint' ;
1366
+
1367
+ // hint's position should be fixed if the target element's position is fixed
1368
+ if ( _isFixed ( item . element ) ) {
1369
+ hint . className += ' introjs-fixedhint' ;
1370
+ }
1371
+
1339
1372
var hintDot = document . createElement ( 'div' ) ;
1340
1373
hintDot . className = 'introjs-hint-dot' ;
1341
1374
var hintPulse = document . createElement ( 'div' ) ;
Original file line number Diff line number Diff line change @@ -345,6 +345,10 @@ tr.introjs-showElement > th {
345
345
top : 50% ;
346
346
}
347
347
348
+ .introjs-fixedTooltip {
349
+ position : fixed;
350
+ }
351
+
348
352
.introjs-hint {
349
353
position : absolute;
350
354
background : transparent;
@@ -353,7 +357,11 @@ tr.introjs-showElement > th {
353
357
}
354
358
355
359
.introjs-hidehint {
356
- display : none;
360
+ display : none;
361
+ }
362
+
363
+ .introjs-fixedhint {
364
+ position : fixed;
357
365
}
358
366
359
367
.introjs-hint : hover > .introjs-hint-pulse {
You can’t perform that action at this time.
0 commit comments