diff --git a/lib/jquery.easyWizard.js b/lib/jquery.easyWizard.js index 7e9d87c..baa5fd6 100644 --- a/lib/jquery.easyWizard.js +++ b/lib/jquery.easyWizard.js @@ -10,7 +10,8 @@ * http://www.opensource.org/licenses/GPL-2.0 * ======================================================== */ (function( $ ) { - var arrSettings = []; + var index = 0, + arrSettings = []; var easyWizardMethods = { init : function(options) { var settings = $.extend( { @@ -40,7 +41,11 @@ } }, options); - arrSettings[this.index()] = settings; + if(typeof this.data('index') === 'undefined'){ + this.data('index', index); + index++; + } + arrSettings[this.data('index')] = settings; return this.each(function() { thisSettings = settings; @@ -127,7 +132,7 @@ }); }, prevStep : function( ) { - thisSettings = arrSettings[this.index()]; + thisSettings = arrSettings[this.data('index')]; $activeStep = this.find('.'+ thisSettings.stepClassName +'.active'); if($activeStep.prev('.'+thisSettings.stepClassName).length) { prevStep = parseInt($activeStep.attr('data-step')) - 1; @@ -135,7 +140,7 @@ } }, nextStep : function( ) { - thisSettings = arrSettings[this.index()]; + thisSettings = arrSettings[this.data('index')]; $activeStep = this.find('.'+ thisSettings.stepClassName +'.active'); if($activeStep.next('.'+thisSettings.stepClassName).length) { nextStep = parseInt($activeStep.attr('data-step')) + 1; @@ -143,7 +148,7 @@ } }, goToStep : function(step) { - thisSettings = arrSettings[this.index()]; + thisSettings = arrSettings[this.data('index')]; $activeStep = this.find('.'+ thisSettings.stepClassName +'.active'); $nextStep = this.find('.'+thisSettings.stepClassName+'[data-step="'+step+'"]'); currentStep = $activeStep.attr('data-step');