Skip to content

Commit ef3de60

Browse files
zutabostikforever
authored andcommitted
Add option for disable/enable interaction inside examining area
1 parent 8b03565 commit ef3de60

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

intro.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@
5757
/* Scroll to highlighted element? */
5858
scrollToElement: true,
5959
/* Set the overlay opacity */
60-
overlayOpacity: 0.8
60+
overlayOpacity: 0.8,
61+
/* Disable an interaction with element? */
62+
disableInteraction: false
6163
};
6264
}
6365

@@ -345,6 +347,11 @@
345347
floatingElement.parentNode.removeChild(floatingElement);
346348
}
347349

350+
//remove element overlay
351+
if (this._options.disableInteraction === true) {
352+
document.querySelector('.introjs-elementOverlay').remove();
353+
}
354+
348355
//remove `introjs-showElement` class from the element
349356
var showElement = document.querySelector('.introjs-showElement');
350357
if (showElement) {
@@ -554,6 +561,12 @@
554561
//remove old classes
555562
var oldShowElement = document.querySelector('.introjs-showElement');
556563
oldShowElement.className = oldShowElement.className.replace(/introjs-[a-zA-Z]+/g, '').replace(/^\s+|\s+$/g, '');
564+
565+
//remove element overlay
566+
if (this._options.disableInteraction === true) {
567+
document.querySelector('.introjs-elementOverlay').remove();
568+
}
569+
557570
//we should wait until the CSS3 transition is competed (it's 0.3 sec) to prevent incorrect `height` and `width` calculation
558571
if (self._lastShowElementTimer) {
559572
clearTimeout(self._lastShowElementTimer);
@@ -718,6 +731,13 @@
718731
//Set focus on "next" button, so that hitting Enter always moves you onto the next step
719732
nextTooltipButton.focus();
720733

734+
//add inner div to prevent posibility interact with element (transparent overlay)
735+
if (this._options.disableInteraction === true) {
736+
var elementOverlay = document.createElement('div');
737+
elementOverlay.className = 'introjs-elementOverlay';
738+
targetElement.element.appendChild(elementOverlay);
739+
}
740+
721741
//add target element position style
722742
targetElement.element.className += ' introjs-showElement';
723743

introjs.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ tr.introjs-showElement > th {
3030
z-index: 9999999 !important;
3131
}
3232

33+
.introjs-elementOverlay {
34+
z-index: 99999999 !important;
35+
position: absolute;
36+
width: 100%;
37+
height: 100%;
38+
top: 0;
39+
left: 0;
40+
}
41+
3342
.introjs-relativePosition,
3443
tr.introjs-showElement > td,
3544
tr.introjs-showElement > th {

0 commit comments

Comments
 (0)