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

Commit b9ff1db

Browse files
committed
Change onexit behavior
1 parent a8ebffa commit b9ff1db

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

intro.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@
106106
if (e.keyCode === 27 && self._options.exitOnEsc == true) {
107107
//escape key pressed, exit the intro
108108
_exitIntro.call(self, targetElm);
109+
//check if any callback is defined
110+
if (self._introExitCallback != undefined) {
111+
self._introExitCallback.call(self);
112+
}
109113
} else if(e.keyCode === 37) {
110114
//left arrow
111115
_previousStep.call(self);
@@ -243,10 +247,6 @@
243247
}
244248
//set the step to zero
245249
this._currentStep = undefined;
246-
//check if any callback is defined
247-
if (this._introExitCallback != undefined) {
248-
this._introExitCallback.call(this);
249-
}
250250
}
251251

252252
/**
@@ -439,6 +439,11 @@
439439
if (self._introItems.length - 1 == self._currentStep && typeof (self._introCompleteCallback) === 'function') {
440440
self._introCompleteCallback.call(self);
441441
}
442+
443+
if (self._introItems.length - 1 != self._currentStep && typeof (self._introExitCallback) === 'function') {
444+
self._introExitCallback.call(self);
445+
}
446+
442447
_exitIntro.call(self, self._targetElement);
443448
};
444449

@@ -601,6 +606,10 @@
601606
if(self._options.exitOnOverlayClick == true) {
602607
_exitIntro.call(self, targetElm);
603608
}
609+
//check if any callback is defined
610+
if (self._introExitCallback != undefined) {
611+
self._introExitCallback.call(self);
612+
}
604613
};
605614

606615
setTimeout(function() {

0 commit comments

Comments
 (0)