Skip to content

Commit df1722b

Browse files
author
meh-cfl
committed
Adding functionality to have a callback before the step is shown.
1 parent 989b6ae commit df1722b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

js/jquery.form.wizard.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,15 @@
256256
}
257257
},
258258

259-
_animate : function(oldStep, newStep, stepShownCallback){
259+
_animate : function(oldStep, newStep, stepToShowCallback, stepShownCallback){
260260
this._disableNavigation();
261261
var old = this.steps.filter("#" + oldStep);
262262
var current = this.steps.filter("#" + newStep);
263263
old.find(":input").not(".wizard-ignore").attr("disabled","disabled");
264264
current.find(":input").not(".wizard-ignore").removeAttr("disabled");
265265
var wizard = this;
266266
old.animate(wizard.options.outAnimation, wizard.options.outDuration, wizard.options.easing, function(){
267+
stepToShowCallback.apply(wizard);
267268
current.animate(wizard.options.inAnimation, wizard.options.inDuration, wizard.options.easing, function(){
268269
if(wizard.options.focusFirstInput)
269270
current.find(":input:first").focus();
@@ -330,7 +331,8 @@
330331
this._checkIflastStep(step);
331332
this.currentStep = step;
332333
var stepShownCallback = function(){if(triggerStepShown)$(this.element).trigger('step_shown', $.extend({"isBackNavigation" : backwards},this._state()));};
333-
this._animate(this.previousStep, step, stepShownCallback);
334+
var stepToShowCallback = function(){if(triggerStepShown)$(this.element).trigger('step_to_show', $.extend({"isBackNavigation" : backwards},this._state()));};
335+
this._animate(this.previousStep, step, stepToShowCallback, stepShownCallback);
334336
};
335337

336338

0 commit comments

Comments
 (0)