Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method reset #149

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/privates.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
11 changes: 11 additions & 0 deletions src/publics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down