Skip to content

Commit b14bae4

Browse files
committed
Fix onbeforechange problem
1 parent 1f8b2d0 commit b14bae4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

intro.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@
177177
* @method _nextStep
178178
*/
179179
function _nextStep() {
180-
if (typeof (this._introBeforeChangeCallback) !== 'undefined') {
181-
this._introBeforeChangeCallback.call(this, this._targetElement.element);
182-
}
183-
184180
if (typeof (this._currentStep) === 'undefined') {
185181
this._currentStep = 0;
186182
} else {
@@ -197,7 +193,12 @@
197193
return;
198194
}
199195

200-
_showElement.call(this, this._introItems[this._currentStep]);
196+
var nextStep = this._introItems[this._currentStep];
197+
if (typeof (this._introBeforeChangeCallback) !== 'undefined') {
198+
this._introBeforeChangeCallback.call(this, nextStep.element);
199+
}
200+
201+
_showElement.call(this, nextStep);
201202
}
202203

203204
/**
@@ -211,11 +212,12 @@
211212
return false;
212213
}
213214

215+
var nextStep = this._introItems[--this._currentStep];
214216
if (typeof (this._introBeforeChangeCallback) !== 'undefined') {
215-
this._introBeforeChangeCallback.call(this, this._targetElement.element);
217+
this._introBeforeChangeCallback.call(this, nextStep.element);
216218
}
217219

218-
_showElement.call(this, this._introItems[--this._currentStep]);
220+
_showElement.call(this, nextStep);
219221
}
220222

221223
/**

0 commit comments

Comments
 (0)