Skip to content
Open
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
26 changes: 13 additions & 13 deletions lib/jquery.easyWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
return this.each(function() {
thisSettings = settings;

$this = $(this); // Wizard Obj
$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
/* Create UI */
$this.wrapInner('<div class="easyWizardWrapper" />');
$this.find('.easyWizardWrapper').width(thisSettings.width * thisSettings.steps);
$this.css({
Expand Down Expand Up @@ -112,7 +112,7 @@

$formObj = $this.is('form')?$this:$(this).find('form');

// beforeSubmit Callback
/* beforeSubmit Callback */
$this.find('[type="submit"]').bind('click.easyWizard', function(e) {
$wizard = $(this).parents('.easyWizardElement');
var beforeSubmitValue = thisSettings.beforeSubmit($wizard);
Expand Down Expand Up @@ -148,23 +148,23 @@
$nextStep = this.find('.'+thisSettings.stepClassName+'[data-step="'+step+'"]');
currentStep = $activeStep.attr('data-step');

// Prevent sliding same step
/* Prevent sliding same step */
if (currentStep == step) return;

// Before callBack
/* Before callBack */
var beforeValue = thisSettings.before(this, $activeStep, $nextStep);
if(beforeValue === false) {
return false;
}

// Define direction for sliding
if(currentStep < step) { // forward
/* Define direction for sliding */
if(currentStep < step) { /* forward */
leftValue = thisSettings.width * -1;
}else { // backward
}else { /* backward */
leftValue = thisSettings.width;
}

// Slide !
/* Slide ! */
$activeStep.removeClass('active');
$activeStep.find('input, textarea, select, button').attr('tabindex', '-1');

Expand All @@ -177,11 +177,11 @@
$activeStep.css({ height: '1px' });
});

// Defines steps
/* Defines steps */
this.find('.easyWizardSteps .current').removeClass('current');
this.find('.easyWizardSteps li[data-step="'+step+'"]').addClass('current');

// Define buttons
/* Define buttons */
$paginationBloc = this.find('.easyWizardButtons');
if($paginationBloc.length) {
if(step == 1) {
Expand All @@ -191,15 +191,15 @@
$paginationBloc.find('.submit').hide();
$paginationBloc.find('.prev, .next').show();
}else {
if($nextStep.prev('.'+thisSettings.stepClassName).length) { // If there is a previous step, must be always the case but... you know =)
if($nextStep.prev('.'+thisSettings.stepClassName).length) { /* If there is a previous step, must be always the case but... you know =) */
$paginationBloc.find('.prev').show();
}
$paginationBloc.find('.next').hide();
$paginationBloc.find('.submit').show();
}
}

// After callBack
/* After callBack */
thisSettings.after(this, $activeStep, $nextStep);
}
};
Expand Down