stepNumber is incorrect on showStep event when no transition
Mimetis opened this issue · 3 comments
Describe the bug
When setting no transition, the stepNumber
is incorrect on showStep
event
To Reproduce
Steps to reproduce the behavior:
this.smartWizard.smartWizard({
transition: {
animation: 'none', // Effect on navigation, none/fade/slide-horizontal/slide-vertical/slide-swing
speed: '400', // Transion animation speed
easing: '' // Transition animation easing. Not supported without a jQuery easing plugin
},
}
this.smartWizard.on("showStep", async (e, anchorObject, stepNumber, stepDirection, stepPosition) => {
console.log(stepNumber)
}
Expected behavior
stepNumber is incorrect, since the affectation is too late before event is raised
Source
I believe the problem comes from here:
this._doStepAnimation(idx, function () {
// Fix height with content
_this5._fixHeight(idx); // Trigger "showStep" event
_this5._triggerEvent("showStep", [selStep, _this5.current_index, stepDirection, stepPosition]);
}); // Update the current index
this.current_index = idx; // Set the buttons based on the step
the this.current_index = idx;
is happening after the event is triggered _this5._triggerEvent("showStep" ....)
With any animation, it's fine since the triggered is launched after the anim, so far the current_index
is correctly set
But without animation, the affectation happens after the event
This also happens if an animation is set as you can see in #103
Got the same issue. In case animation is set to none, first step is null.
Fixed the issue with incorrect step number on showStep
event when animation none is set on v6. Please see https://github.com/techlab/jquery-smartwizard/releases/tag/v6.0.1
Demo: http://techlaboratory.net/projects/demo/jquery-smart-wizard/v6/#step-1