Skip to content

Commit

Permalink
Fixing issue where elements won't shine through overlay if their pare…
Browse files Browse the repository at this point in the history
…nts have transform applied
  • Loading branch information
raahede committed Apr 25, 2014
1 parent 10fab7d commit 545b8e8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
17 changes: 9 additions & 8 deletions intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
*/
function _previousStep() {
this._direction = 'backward';

if (this._currentStep === 0) {
return false;
}
Expand All @@ -317,7 +317,7 @@
function _exitIntro(targetElement) {
//remove overlay layer from the page
var overlayLayer = targetElement.querySelector('.introjs-overlay');

//return if intro already completed or skipped
if (overlayLayer == null) {
return;
Expand Down Expand Up @@ -363,7 +363,7 @@
} else if (document.detachEvent) { //IE
document.detachEvent('onkeydown', this._onKeyDown);
}

//set the step to zero
this._currentStep = undefined;
}
Expand Down Expand Up @@ -423,7 +423,7 @@
arrowLayer.className = 'introjs-arrow left';
break;
case 'left':
if (this._options.showStepNumbers == true) {
if (this._options.showStepNumbers == true) {
tooltipLayer.style.top = '15px';
}
tooltipLayer.style.right = (_getOffset(targetElement).width + 20) + 'px';
Expand Down Expand Up @@ -712,14 +712,15 @@
while (parentElm != null) {
if (parentElm.tagName.toLowerCase() === 'body') break;

//fix The Stacking Contenxt problem.
//fix The Stacking Contenxt problem.
//More detail: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context
var zIndex = _getPropValue(parentElm, 'z-index');
var opacity = parseFloat(_getPropValue(parentElm, 'opacity'));
if (/[0-9]+/.test(zIndex) || opacity < 1) {
var transform = _getPropValue(parentElm, 'transform') || _getPropValue(parentElm, '-webkit-transform') || _getPropValue(parentElm, '-moz-transform') || _getPropValue(parentElm, '-ms-transform') || _getPropValue(parentElm, '-o-transform');
if (/[0-9]+/.test(zIndex) || opacity < 1 || transform !== 'none') {
parentElm.className += ' introjs-fixParent';
}

parentElm = parentElm.parentNode;
}

Expand All @@ -738,7 +739,7 @@
window.scrollBy(0, bottom + 100); // 70px + 30px padding from edge to look nice
}
}

if (typeof (this._introAfterChangeCallback) !== 'undefined') {
this._introAfterChangeCallback.call(this, targetElement.element);
}
Expand Down
15 changes: 10 additions & 5 deletions introjs.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
.introjs-fixParent {
z-index: auto !important;
opacity: 1.0 !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
-o-transform: none !important;
transform: none !important;
}

.introjs-showElement {
Expand Down Expand Up @@ -72,7 +77,7 @@
line-height: 20px;
border: 3px solid white;
border-radius: 50%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3019', endColorstr='#cf0404', GradientType=0); /* IE6-9 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3019', endColorstr='#cf0404', GradientType=0); /* IE6-9 */
filter: progid:DXImageTransform.Microsoft.Shadow(direction=135, strength=2, color=ff0000); /* IE10 text shadows */
box-shadow: 0 2px 5px rgba(0,0,0,.4);
}
Expand Down Expand Up @@ -132,8 +137,8 @@
text-align: right;
}

/*
Buttons style by http://nicolasgallagher.com/lab/css3-github-buttons/
/*
Buttons style by http://nicolasgallagher.com/lab/css3-github-buttons/
Changed by Afshin Mehrabani
*/
.introjs-button {
Expand Down Expand Up @@ -170,7 +175,7 @@

.introjs-button:hover {
border-color: #bcbcbc;
text-decoration: none;
text-decoration: none;
box-shadow: 0px 1px 1px #e3e3e3;
}

Expand Down Expand Up @@ -252,4 +257,4 @@
width: 0;
left: 50%;
top: 50%;
}
}

0 comments on commit 545b8e8

Please sign in to comment.