diff --git a/README.md b/README.md
index ea3762b..9db948f 100755
--- a/README.md
+++ b/README.md
@@ -25,8 +25,8 @@ git clone http://github.com/oguzhanoya/jquery-steps.git
```
CDN
```html
-
-
+
+
```
## Setup
@@ -102,6 +102,7 @@ Init plugin with choosen options.
|finish|Trigger the onFinish event.|
|getStepIndex|Gets the current step index.(start from 0)|
|getMaxStepIndex|Gets the max step index.|
+|setStepIndex|Sets the step index.|
## License
diff --git a/dist/jquery-steps.js b/dist/jquery-steps.js
index 0b763e1..4c0dadf 100644
--- a/dist/jquery-steps.js
+++ b/dist/jquery-steps.js
@@ -1,5 +1,5 @@
/*!
- * Steps v1.1.0
+ * Steps v1.1.1
* https://github.com/oguzhanoya/jquery-steps
*
* Copyright (c) 2020 oguzhanoya
@@ -256,6 +256,16 @@
this.setActiveStep(stepIndex, nextStep);
}
}
+ }, {
+ key: "setStepIndex",
+ value: function setStepIndex(idx) {
+ var maxIndex = this.getMaxStepIndex();
+
+ if (idx <= maxIndex) {
+ var stepIndex = this.getStepIndex();
+ this.setActiveStep(stepIndex, idx);
+ }
+ }
}, {
key: "next",
value: function next() {
@@ -289,7 +299,7 @@
return Steps;
}();
- var version = "1.1.0";
+ var version = "1.1.1";
var other = $__default['default'].fn.steps;
diff --git a/dist/jquery-steps.js.map b/dist/jquery-steps.js.map
index 977ba9a..72822e9 100644
--- a/dist/jquery-steps.js.map
+++ b/dist/jquery-steps.js.map
@@ -1 +1 @@
-{"version":3,"file":"jquery-steps.js","sources":["../src/Defaults.js","../src/Steps.js","../src/Plugin.js"],"sourcesContent":["export default {\n startAt: 0,\n showBackButton: true,\n showFooterButtons: true,\n onInit: $.noop,\n onDestroy: $.noop,\n onFinish: $.noop,\n onChange() { return true; },\n stepSelector: '.step-steps',\n contentSelector: '.step-content',\n footerSelector: '.step-footer',\n activeClass: 'active',\n doneClass: 'done',\n errorClass: 'error',\n};\n","import $ from 'jquery';\nimport DEFAULTS from './Defaults';\n\nclass Steps {\n constructor(element, options) {\n // Extend defaults with the init options.\n this.options = $.extend({}, DEFAULTS, options);\n\n // Store main DOM element.\n this.el = $(element);\n\n this.stepSelector = `${this.options.stepSelector} [data-step-target]`;\n this.footerSelector = `${this.options.footerSelector} [data-step-action]`;\n this.contentSelector = `${this.options.contentSelector} [data-step]`;\n\n // Initialize\n this.init();\n }\n\n stepClick(e) {\n e.preventDefault();\n const nextStep = $(this).closest('[data-step-target]').index();\n const stepIndex = e.data.self.getStepIndex();\n e.data.self.setActiveStep(stepIndex, nextStep);\n }\n\n btnClick(e) {\n e.preventDefault();\n const statusAction = $(this).data('step-action');\n e.data.self.setAction(statusAction);\n }\n\n init() {\n this.hook('onInit');\n const self = this;\n\n // step click event\n $(this.el).find(this.stepSelector).on('click', { self }, this.stepClick);\n\n // button click event\n $(this.el).find(this.footerSelector).on('click', { self }, this.btnClick);\n\n // set default step\n this.setActiveStep(0, this.options.startAt, true);\n\n this.setFooterBtns();\n\n // show footer buttons\n if (!this.options.showFooterButtons) {\n this.hideFooterBtns();\n this.setFooterBtns = $.noop;\n }\n }\n\n hook(hookName) {\n if (this.options[hookName] !== undefined) {\n this.options[hookName].call(this.el);\n }\n }\n\n destroy() {\n this.hook('onDestroy');\n $(this.el).find(this.stepSelector).off('click');\n $(this.el).find(this.footerSelector).off('click');\n this.el.removeData('plugin_Steps');\n this.el.remove();\n }\n\n getStepIndex() {\n const stepIndex = this.el.find(this.stepSelector)\n .filter(`.${this.options.activeClass.split(' ').join('.')}`)\n .index();\n return stepIndex || 0;\n }\n\n getMaxStepIndex() {\n return this.el.find(this.stepSelector).length - 1;\n }\n\n getStepDirection(stepIndex, newIndex) {\n let direction = 'none';\n if (newIndex < stepIndex) {\n direction = 'backward';\n } else if (newIndex > stepIndex) {\n direction = 'forward';\n }\n return direction;\n }\n\n setShowStep(idx, removeClass, addClass = '') {\n const $targetStep = this.el.find(this.stepSelector).eq(idx);\n $targetStep.removeClass(removeClass).addClass(addClass);\n const $tabContent = this.el.find(this.contentSelector);\n $tabContent.removeClass(this.options.activeClass).eq(idx).addClass(this.options.activeClass);\n }\n\n setActiveStep(currentIndex, newIndex, init = false) {\n if (newIndex !== currentIndex || init) {\n const conditionDirection = (newIndex > currentIndex)\n ? (start) => start <= newIndex\n : (start) => start >= newIndex;\n\n const conditionIncrementOrDecrement = (newIndex > currentIndex)\n ? (start) => { let s = start; s += 1; return s; }\n : (start) => { let s = start; s -= 1; return s; };\n\n let i = currentIndex;\n while (conditionDirection(i)) {\n const stepDirection = this.getStepDirection(i, newIndex);\n if (i === newIndex) {\n this.setShowStep(i, this.options.doneClass, this.options.activeClass);\n } else {\n const checkDone = stepDirection === 'forward' && this.options.doneClass;\n this.setShowStep(i, `${this.options.activeClass} ${this.options.errorClass} ${this.options.doneClass}`, checkDone);\n }\n const validStep = this.options.onChange(i, newIndex, stepDirection);\n if (!validStep) {\n this.setShowStep(i, this.options.doneClass, `${this.options.activeClass} ${this.options.errorClass}`);\n i = newIndex;\n }\n i = conditionIncrementOrDecrement(i);\n }\n this.setFooterBtns();\n }\n }\n\n setFooterBtns() {\n const stepIndex = this.getStepIndex();\n const maxIndex = this.getMaxStepIndex();\n const $footer = this.el.find(this.options.footerSelector);\n\n if (stepIndex === 0) {\n $footer.find('[data-step-action=\"prev\"]').hide();\n }\n\n if (stepIndex > 0 && this.options.showBackButton) {\n $footer.find('[data-step-action=\"prev\"]').show();\n }\n\n if (maxIndex === stepIndex) {\n $footer.find('[data-step-action=\"prev\"]').show();\n $footer.find('[data-step-action=\"next\"]').hide();\n $footer.find('[data-step-action=\"finish\"]').show();\n } else {\n $footer.find('[data-step-action=\"next\"]').show();\n $footer.find('[data-step-action=\"finish\"]').hide();\n }\n\n if (!this.options.showBackButton) {\n $footer.find('[data-step-action=\"prev\"]').hide();\n }\n }\n\n setAction(action) {\n const stepIndex = this.getStepIndex();\n let nextStep = stepIndex;\n if (action === 'prev') { nextStep -= 1; }\n if (action === 'next') { nextStep += 1; }\n if (action === 'finish') {\n const validStep = this.options.onChange(stepIndex, nextStep, 'forward');\n if (validStep) {\n this.hook('onFinish');\n } else {\n this.setShowStep(stepIndex, '', this.options.errorClass);\n }\n } else {\n this.setActiveStep(stepIndex, nextStep);\n }\n }\n\n next() {\n const stepIndex = this.getStepIndex();\n const maxIndex = this.getMaxStepIndex();\n return maxIndex === stepIndex ? this.setAction('finish') : this.setAction('next');\n }\n\n prev() {\n const stepIndex = this.getStepIndex();\n return stepIndex !== 0 && this.setAction('prev');\n }\n\n finish() {\n this.hook('onFinish');\n }\n\n hideFooterBtns() {\n this.el.find(this.options.footerSelector).hide();\n }\n\n static setDefaults(options) {\n $.extend(DEFAULTS, $.isPlainObject(options) && options);\n }\n}\n\nexport default Steps;\n","import $ from 'jquery';\nimport Steps from './Steps';\nimport { version } from '../package.json';\n\nconst other = $.fn.steps;\n\n$.fn.steps = function (options) {\n return this.each(function () {\n if (!$.data(this, 'plugin_Steps')) {\n $.data(this, 'plugin_Steps', new Steps(this, options));\n }\n });\n};\n\n$.fn.steps.version = version;\n$.fn.steps.setDefaults = Steps.setDefaults;\n\n// No conflict\n$.fn.steps.noConflict = function () {\n $.fn.steps = other;\n return this;\n};\n"],"names":["startAt","showBackButton","showFooterButtons","onInit","$","noop","onDestroy","onFinish","onChange","stepSelector","contentSelector","footerSelector","activeClass","doneClass","errorClass","Steps","element","options","extend","DEFAULTS","el","init","e","preventDefault","nextStep","closest","index","stepIndex","data","self","getStepIndex","setActiveStep","statusAction","setAction","hook","find","on","stepClick","btnClick","setFooterBtns","hideFooterBtns","hookName","undefined","call","off","removeData","remove","filter","split","join","length","newIndex","direction","idx","removeClass","addClass","$targetStep","eq","$tabContent","currentIndex","conditionDirection","start","conditionIncrementOrDecrement","s","i","stepDirection","getStepDirection","setShowStep","checkDone","validStep","maxIndex","getMaxStepIndex","$footer","hide","show","action","isPlainObject","other","fn","steps","each","version","setDefaults","noConflict"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iBAAe;EACbA,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AR,CAAa,KAAKlB,OAAL,CAAaN,cAA1B,EAA0C8D,IAA1C;EACD;;;kCAEkBxD,SAAS;EAC1Bb,MAAAA,qBAAC,CAACc,MAAF,CAASC,QAAT,EAAmBf,qBAAC,CAACwE,aAAF,CAAgB3D,OAAhB,KAA4BA,OAA/C;EACD;;;;;;;;EC3LH,IAAM4D,KAAK,GAAGzE,qBAAC,CAAC0E,EAAF,CAAKC,KAAnB;;AAEA3E,uBAAC,CAAC0E,EAAF,CAAKC,KAAL,GAAa,UAAU9D,OAAV,EAAmB;EAC9B,SAAO,KAAK+D,IAAL,CAAU,YAAY;EAC3B,QAAI,CAAC5E,qBAAC,CAACwB,IAAF,CAAO,IAAP,EAAa,cAAb,CAAL,EAAmC;EACjCxB,MAAAA,qBAAC,CAACwB,IAAF,CAAO,IAAP,EAAa,cAAb,EAA6B,IAAIb,KAAJ,CAAU,IAAV,EAAgBE,OAAhB,CAA7B;EACD;EACF,GAJM,CAAP;EAKD,CAND;;AAQAb,uBAAC,CAAC0E,EAAF,CAAKC,KAAL,CAAWE,OAAX,GAAqBA,OAArB;AACA7E,uBAAC,CAAC0E,EAAF,CAAKC,KAAL,CAAWG,WAAX,GAAyBnE,KAAK,CAACmE,WAA/B;;AAGA9E,uBAAC,CAAC0E,EAAF,CAAKC,KAAL,CAAWI,UAAX,GAAwB,YAAY;EAClC/E,EAAAA,qBAAC,CAAC0E,EAAF,CAAKC,KAAL,GAAaF,KAAb;EACA,SAAO,IAAP;EACD,CAHD;;;;"}
\ No newline at end of file
+{"version":3,"file":"jquery-steps.js","sources":["../src/Defaults.js","../src/Steps.js","../src/Plugin.js"],"sourcesContent":["export default {\n startAt: 0,\n showBackButton: true,\n showFooterButtons: true,\n onInit: $.noop,\n onDestroy: $.noop,\n onFinish: $.noop,\n onChange() { return true; },\n stepSelector: '.step-steps',\n contentSelector: '.step-content',\n footerSelector: '.step-footer',\n activeClass: 'active',\n doneClass: 'done',\n errorClass: 'error',\n};\n","import $ from 'jquery';\nimport DEFAULTS from './Defaults';\n\nclass Steps {\n constructor(element, options) {\n // Extend defaults with the init options.\n this.options = $.extend({}, DEFAULTS, options);\n\n // Store main DOM element.\n this.el = $(element);\n\n this.stepSelector = `${this.options.stepSelector} [data-step-target]`;\n this.footerSelector = `${this.options.footerSelector} [data-step-action]`;\n this.contentSelector = `${this.options.contentSelector} [data-step]`;\n\n // Initialize\n this.init();\n }\n\n stepClick(e) {\n e.preventDefault();\n const nextStep = $(this).closest('[data-step-target]').index();\n const stepIndex = e.data.self.getStepIndex();\n e.data.self.setActiveStep(stepIndex, nextStep);\n }\n\n btnClick(e) {\n e.preventDefault();\n const statusAction = $(this).data('step-action');\n e.data.self.setAction(statusAction);\n }\n\n init() {\n this.hook('onInit');\n const self = this;\n\n // step click event\n $(this.el).find(this.stepSelector).on('click', { self }, this.stepClick);\n\n // button click event\n $(this.el).find(this.footerSelector).on('click', { self }, this.btnClick);\n\n // set default step\n this.setActiveStep(0, this.options.startAt, true);\n\n this.setFooterBtns();\n\n // show footer buttons\n if (!this.options.showFooterButtons) {\n this.hideFooterBtns();\n this.setFooterBtns = $.noop;\n }\n }\n\n hook(hookName) {\n if (this.options[hookName] !== undefined) {\n this.options[hookName].call(this.el);\n }\n }\n\n destroy() {\n this.hook('onDestroy');\n $(this.el).find(this.stepSelector).off('click');\n $(this.el).find(this.footerSelector).off('click');\n this.el.removeData('plugin_Steps');\n this.el.remove();\n }\n\n getStepIndex() {\n const stepIndex = this.el.find(this.stepSelector)\n .filter(`.${this.options.activeClass.split(' ').join('.')}`)\n .index();\n return stepIndex || 0;\n }\n\n getMaxStepIndex() {\n return this.el.find(this.stepSelector).length - 1;\n }\n\n getStepDirection(stepIndex, newIndex) {\n let direction = 'none';\n if (newIndex < stepIndex) {\n direction = 'backward';\n } else if (newIndex > stepIndex) {\n direction = 'forward';\n }\n return direction;\n }\n\n setShowStep(idx, removeClass, addClass = '') {\n const $targetStep = this.el.find(this.stepSelector).eq(idx);\n $targetStep.removeClass(removeClass).addClass(addClass);\n const $tabContent = this.el.find(this.contentSelector);\n $tabContent.removeClass(this.options.activeClass).eq(idx).addClass(this.options.activeClass);\n }\n\n setActiveStep(currentIndex, newIndex, init = false) {\n if (newIndex !== currentIndex || init) {\n const conditionDirection = (newIndex > currentIndex)\n ? (start) => start <= newIndex\n : (start) => start >= newIndex;\n\n const conditionIncrementOrDecrement = (newIndex > currentIndex)\n ? (start) => { let s = start; s += 1; return s; }\n : (start) => { let s = start; s -= 1; return s; };\n\n let i = currentIndex;\n while (conditionDirection(i)) {\n const stepDirection = this.getStepDirection(i, newIndex);\n if (i === newIndex) {\n this.setShowStep(i, this.options.doneClass, this.options.activeClass);\n } else {\n const checkDone = stepDirection === 'forward' && this.options.doneClass;\n this.setShowStep(i, `${this.options.activeClass} ${this.options.errorClass} ${this.options.doneClass}`, checkDone);\n }\n const validStep = this.options.onChange(i, newIndex, stepDirection);\n if (!validStep) {\n this.setShowStep(i, this.options.doneClass, `${this.options.activeClass} ${this.options.errorClass}`);\n i = newIndex;\n }\n i = conditionIncrementOrDecrement(i);\n }\n this.setFooterBtns();\n }\n }\n\n setFooterBtns() {\n const stepIndex = this.getStepIndex();\n const maxIndex = this.getMaxStepIndex();\n const $footer = this.el.find(this.options.footerSelector);\n\n if (stepIndex === 0) {\n $footer.find('[data-step-action=\"prev\"]').hide();\n }\n\n if (stepIndex > 0 && this.options.showBackButton) {\n $footer.find('[data-step-action=\"prev\"]').show();\n }\n\n if (maxIndex === stepIndex) {\n $footer.find('[data-step-action=\"prev\"]').show();\n $footer.find('[data-step-action=\"next\"]').hide();\n $footer.find('[data-step-action=\"finish\"]').show();\n } else {\n $footer.find('[data-step-action=\"next\"]').show();\n $footer.find('[data-step-action=\"finish\"]').hide();\n }\n\n if (!this.options.showBackButton) {\n $footer.find('[data-step-action=\"prev\"]').hide();\n }\n }\n\n setAction(action) {\n const stepIndex = this.getStepIndex();\n let nextStep = stepIndex;\n if (action === 'prev') { nextStep -= 1; }\n if (action === 'next') { nextStep += 1; }\n if (action === 'finish') {\n const validStep = this.options.onChange(stepIndex, nextStep, 'forward');\n if (validStep) {\n this.hook('onFinish');\n } else {\n this.setShowStep(stepIndex, '', this.options.errorClass);\n }\n } else {\n this.setActiveStep(stepIndex, nextStep);\n }\n }\n\n setStepIndex(idx) {\n const maxIndex = this.getMaxStepIndex();\n if (idx <= maxIndex) {\n const stepIndex = this.getStepIndex();\n this.setActiveStep(stepIndex, idx);\n }\n }\n\n next() {\n const stepIndex = this.getStepIndex();\n const maxIndex = this.getMaxStepIndex();\n return maxIndex === stepIndex ? this.setAction('finish') : this.setAction('next');\n }\n\n prev() {\n const stepIndex = this.getStepIndex();\n return stepIndex !== 0 && this.setAction('prev');\n }\n\n finish() {\n this.hook('onFinish');\n }\n\n hideFooterBtns() {\n this.el.find(this.options.footerSelector).hide();\n }\n\n static setDefaults(options) {\n $.extend(DEFAULTS, $.isPlainObject(options) && options);\n }\n}\n\nexport default Steps;\n","import $ from 'jquery';\nimport Steps from './Steps';\nimport { version } from '../package.json';\n\nconst other = $.fn.steps;\n\n$.fn.steps = function (options) {\n return this.each(function () {\n if (!$.data(this, 'plugin_Steps')) {\n $.data(this, 'plugin_Steps', new Steps(this, options));\n }\n });\n};\n\n$.fn.steps.version = version;\n$.fn.steps.setDefaults = Steps.setDefaults;\n\n// No conflict\n$.fn.steps.noConflict = function () {\n $.fn.steps = other;\n return this;\n};\n"],"names":["startAt","showBackButton","showFooterButtons","onInit","$","noop","onDestroy","onFinish","onChange","stepSelector","contentSelector","footerSelector","activeClass","doneClass","errorClass","Steps","element","options","extend","DEFAULTS","el","init","e","preventDefault","nextStep","closest","index","stepIndex","data","self","getStepIndex","setActiveStep","statusAction","setAction","hook","find","on","stepClick","btnClick","setFooterBtns","hideFooterBtns","hookName","undefined","call","off","removeData","remove","filter","split","join","length","newIndex","direction","idx","removeClass","addClass","$targetStep","eq","$tabContent","currentIndex","conditionDirection","start","conditionIncrementOrDecrement","s","i","stepDirection","getStepDirection","setShowStep","checkDone","validStep","maxIndex","getMaxStepIndex","$footer","hide","show","action","isPlainObject","other","fn","steps","each","version","setDefaults","noConflict"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iBAAe;EACbA,EAAAA,OAAO,EAAE,CADI;EAEbC,EAAAA,cAAc,EAAE,IAFH;EAGbC,EAAAA,iBAAiB,EAAE,IAHN;EAIbC,EAAAA,MAAM,EAAEC,CAAC,CAACC,IAJG;EAKbC,EAAAA,SAAS,EAAEF,CAAC,CAACC,IALA;EAMbE,EAAAA,QAAQ,EAAEH,CAAC,CAACC,IANC;EAObG,EAAAA,QAPa,sBAOF;EAAE,WAAO,IAAP;EAAc,GAPd;EAQbC,EAAAA,YAAY,EAAE,aARD;EASbC,EAAAA,eAAe,EAAE,eATJ;EAUbC,EAAAA,cAAc,EAAE,cAVH;EAWbC,EAAAA,WAAW,EAAE,QAXA;EAYbC,EAAAA,SAAS,EAAE,MAZE;EAabC,EAAAA,UAAU,EAAE;EAbC,CAAf;;MCGMC;EACJ,iBAAYC,OAAZ,EAAqBC,OAArB,EAA8B;EAAA;;EAC5B;EACA,SAAKA,OAAL,GAAeb,qBAAC,CAACc,MAAF,CAAS,EAAT,EAAaC,QAAb,EAAuBF,OAAvB,CAAf,CAF4B;;EAK5B,SAAKG,EAAL,GAAUhB,qBAAC,CAACY,OAAD,CAAX;EAEA,SAAKP,YAAL,aAAuB,KAAKQ,OAAL,CAAaR,YAApC;EACA,SAAKE,cAAL,aAAyB,KAAKM,OAAL,CAAaN,cAAtC;EACA,SAAKD,eAAL,aAA0B,KAAKO,OAAL,CAAaP,eAAvC,kBAT4B;;EAY5B,SAAKW,IAAL;EACD;;;;gCAESC,GAAG;EACXA,MAAAA,CAAC,CAACC,cAAF;EACA,UAAMC,QAAQ,GAAGpB,qBAAC,CAAC,IAAD,CAAD,CAAQqB,OAAR,CAAgB,oBAAhB,EAAsCC,KAAtC,EAAjB;EACA,UAAMC,SAA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AA,qBAAC,CAAC0E,EAAF,CAAKC,KAAL,GAAaF,KAAb;EACA,SAAO,IAAP;EACD,CAHD;;;;"}
\ No newline at end of file
diff --git a/dist/jquery-steps.min.js b/dist/jquery-steps.min.js
index 918f84e..1f78dad 100644
--- a/dist/jquery-steps.min.js
+++ b/dist/jquery-steps.min.js
@@ -1,8 +1,8 @@
/*!
- * Steps v1.1.0
+ * Steps v1.1.1
* https://github.com/oguzhanoya/jquery-steps
*
* Copyright (c) 2020 oguzhanoya
* Released under the MIT license
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).$)}(this,function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=e(t);function i(t,e){for(var s=0;sCurrent Step Index
+
+
+
+
@@ -53,6 +57,7 @@
alert('Wizard Completed');
}
});
+
steps_api = steps.data('plugin_Steps');
$('#btnPrev').on('click', function () {
@@ -64,15 +69,28 @@
});
$('#btnGetStepIndex').on('click', function () {
- const idx = steps_api.getStepIndex();
+ var idx = steps_api.getStepIndex();
alert(idx);
});
$('#btnGetMaxStepIndex').on('click', function () {
- const idx = steps_api.getMaxStepIndex();
+ var idx = steps_api.getMaxStepIndex();
alert(idx);
});
+ $('#btnGoToFirstStep').on('click', function () {
+ steps_api.setStepIndex(0);
+ });
+
+ $('#btnGoToStep2').on('click', function () {
+ steps_api.setStepIndex(1);
+ });
+
+ $('#btnGoToLastStep').on('click', function () {
+ var maxIdx = steps_api.getMaxStepIndex();
+ steps_api.setStepIndex(maxIdx);
+ });
+
$('#btnDestroy').on('click', function () {
steps_api.destroy();
});
diff --git a/package-lock.json b/package-lock.json
index 4944f0a..da9e2f4 100755
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "jquery.steps",
- "version": "1.1.0",
+ "version": "1.1.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index b6c03eb..249aaec 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.steps",
- "version": "1.1.0",
+ "version": "1.1.1",
"description": "A simple, lightweight jQuery step wizard plugin.",
"main": "./dist/jquery-steps.js",
"repository": {
diff --git a/src/Steps.js b/src/Steps.js
index 4620a35..0c2f500 100755
--- a/src/Steps.js
+++ b/src/Steps.js
@@ -168,6 +168,14 @@ class Steps {
}
}
+ setStepIndex(idx) {
+ const maxIndex = this.getMaxStepIndex();
+ if (idx <= maxIndex) {
+ const stepIndex = this.getStepIndex();
+ this.setActiveStep(stepIndex, idx);
+ }
+ }
+
next() {
const stepIndex = this.getStepIndex();
const maxIndex = this.getMaxStepIndex();