From 40e38284f5487284a88b444704e45a6ed76b8eda Mon Sep 17 00:00:00 2001 From: Jonathan Schmid Date: Wed, 1 Jul 2015 15:48:10 +0100 Subject: [PATCH] Add method reset --- src/publics.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/publics.js b/src/publics.js index 9a80050..70c01be 100644 --- a/src/publics.js +++ b/src/publics.js @@ -57,6 +57,26 @@ $.fn.steps.finish = function () finishStep(this, getState(this)); }; +/** + * Routes to first step and resets all states. + * + * @method reset + * @chainable + */ +$.fn.steps.reset = function () { + var wizard = this, + options = getOptions(this), + state = getState(this); + goToStep(wizard, options, state, 0); + + for (i = 1; i < state.stepCount; i++) { + var stepAnchor = getStepAnchor(wizard, i); + stepAnchor.parent().removeClass("done")._enableAria(false); + } + + return this; +}; + /** * Gets the current step index. *