diff --git a/src/privates.js b/src/privates.js index 95362ce..e2160e9 100644 --- a/src/privates.js +++ b/src/privates.js @@ -206,6 +206,26 @@ function destroy(wizard, options) return wizardSubstitute; } +/** + * Routes to first step and resets state. + * + * @static + * @private + * @method reset + */ +function _reset(wizard, options) +{ + var state = getState(wizard), + i; + + goToStep(wizard, options, state, 0); + + for (i = 1; i < state.stepCount; i++) { + var stepAnchor = getStepAnchor(wizard, i); + stepAnchor.parent().removeClass("done")._enableAria(false); + } +} + /** * Triggers the onFinishing and onFinished event. * diff --git a/src/publics.js b/src/publics.js index 9a80050..93ddd23 100644 --- a/src/publics.js +++ b/src/publics.js @@ -47,6 +47,17 @@ $.fn.steps.destroy = function () return destroy(this, getOptions(this)); }; +/** + * Routes to first step and resets state. + * + * @method reset + * @chainable + **/ +$.fn.steps.reset = function () +{ + return _reset(this, getOptions(this)); +}; + /** * Triggers the onFinishing and onFinished event. *