Skip to content

Commit 8315462

Browse files
committed
Add onchange callback, related to usablica#47
2 parents 13b22c5 + 300a5f6 commit 8315462

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

intro.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,11 @@
222222
* @param {Object} targetElement
223223
*/
224224
function _showElement(targetElement) {
225-
225+
226+
if (typeof this._introChangeCallback !== 'undefined') {
227+
this._introChangeCallback.call(this, targetElement);
228+
}
229+
226230
var self = this,
227231
oldHelperLayer = document.querySelector(".introjs-helperLayer"),
228232
elementPosition = _getOffset(targetElement);
@@ -531,6 +535,13 @@
531535
},
532536
exit: function() {
533537
_exitIntro.call(this, this._targetElement);
538+
},
539+
onchange: function(providedCallback) {
540+
if (typeof (providedCallback) === "function") {
541+
this._introChangeCallback = providedCallback;
542+
} else {
543+
throw new Error("Provided callback for onchange was not a function.");
544+
}
534545
return this;
535546
},
536547
oncomplete: function(providedCallback) {

0 commit comments

Comments
 (0)