File tree Expand file tree Collapse file tree 2 files changed +25
-20
lines changed Expand file tree Collapse file tree 2 files changed +25
-20
lines changed Original file line number Diff line number Diff line change 520
520
tooltipOffset = _getOffset ( tooltipLayer ) ;
521
521
522
522
arrowLayer . className = 'introjs-arrow top-middle' ;
523
- tooltipLayer . style . left = ( targetElementOffset . width / 2 - tooltipOffset . width / 2 ) + 'px' ;
523
+ var tooltipLayerStyleLeft = targetElementOffset . width / 2 - tooltipOffset . width / 2 ;
524
+ // off the right side of the window
525
+ if ( targetElementOffset . left + tooltipLayerStyleLeft + tooltipOffset . width > windowSize . width )
526
+ tooltipLayer . style . left = ( windowSize . width - tooltipOffset . width - targetElementOffset . left ) + 'px' ;
527
+ else
528
+ tooltipLayer . style . left = tooltipLayerStyleLeft + 'px' ;
524
529
tooltipLayer . style . top = ( targetElementOffset . height + 20 ) + 'px' ;
525
530
break ;
526
531
case 'bottom-left-aligned' :
You can’t perform that action at this time.
0 commit comments