Skip to content
This repository was archived by the owner on Feb 4, 2021. It is now read-only.

Commit e602d40

Browse files
committed
Add exitOnEsc and exitOnOverlayClick options
1 parent 027f40e commit e602d40

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

intro.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
prevLabel: '← Back',
3535
skipLabel: 'Skip',
3636
doneLabel: 'Done',
37-
tooltipPosition: 'bottom'
37+
tooltipPosition: 'bottom',
38+
exitOnEsc: true,
39+
exitOnOverlayClick: true
3840
};
3941
}
4042

@@ -96,7 +98,7 @@
9698
nextStepButton = targetElm.querySelector('.introjs-nextbutton');
9799

98100
self._onKeyDown = function(e) {
99-
if (e.keyCode === 27) {
101+
if (e.keyCode === 27 && self._options.exitOnEsc) {
100102
//escape key pressed, exit the intro
101103
_exitIntro.call(self, targetElm);
102104
} else if(e.keyCode === 37) {
@@ -520,9 +522,11 @@
520522

521523
targetElm.appendChild(overlayLayer);
522524

523-
overlayLayer.onclick = function() {
524-
_exitIntro.call(self, targetElm);
525-
};
525+
if(this._options.exitOnOverlayClick) {
526+
overlayLayer.onclick = function() {
527+
_exitIntro.call(self, targetElm);
528+
};
529+
}
526530

527531
setTimeout(function() {
528532
styleText += 'opacity: .5;';

0 commit comments

Comments
 (0)