/* ======================================================== * easyWizard v1 * http://st3ph.github.com/jquery.easyWizard * ======================================================== * Copyright 2012 Stéphane Litou * * Dual licensed under the MIT or GPL Version 2 licenses. * http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/GPL-2.0 * ======================================================== */ (function( $ ) { var arrSettings = new Array(); var easyWizardMethods = { init : function(options) { var settings = $.extend( { 'stepClassName' : 'step', 'showSteps' : true, 'stepsText' : '{n} {t}', 'showButtons' : true, 'buttonsClass' : '', 'prevButton' : '« Back', 'nextButton' : 'Next »', 'debug' : false, 'submitButton': true, 'submitButtonText': 'Submit', 'submitButtonClass': '', before: function(wizardObj, currentStepObj, nextStepObj) {}, after: function(wizardObj, prevStepObj, currentStepObj) {}, beforeSubmit: function(wizardObj) { wizardObj.find('input, textarea').each(function() { if(!this.checkValidity()) { this.focus(); step = $(this).parents('.'+thisSettings.stepClassName).attr('data-step'); easyWizardMethods.goToStep.call(wizardObj, step); return false; } }); } }, options); arrSettings[this.index()] = settings; return this.each(function() { thisSettings = settings; $this = $(this); // Wizard Obj $this.addClass('easyWizardElement'); $steps = $this.find('.'+thisSettings.stepClassName); thisSettings.steps = $steps.length; thisSettings.width = $(this).width(); if(thisSettings.steps > 1) { // Create UI $this.wrapInner('
'); $this.find('.easyWizardWrapper').width(thisSettings.width * thisSettings.steps); $this.css({ 'position': 'relative', 'overflow': 'hidden' }).addClass('easyPager'); $stepsHtml = $('