Skip to content

Instantly share code, notes, and snippets.

@ripper234
Created February 26, 2012 08:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ripper234/1915367 to your computer and use it in GitHub Desktop.
Save ripper234/1915367 to your computer and use it in GitHub Desktop.
Add page css to form in jquery-form-wizard.
eb31fd63a313757ad25c032248a28944d375959f
.../jquery-ui-wizard/jquery.form.wizard.js | 27 +++++++++++++++++---
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/portal/src/public/libraries/jquery-ui-wizard/jquery.form.wizard.js b/portal/src/public/libraries/jquery-ui-wizard/jquery.form.wizard.js
index 39a2397..c5525a9 100644
--- a/portal/src/public/libraries/jquery-ui-wizard/jquery.form.wizard.js
+++ b/portal/src/public/libraries/jquery-ui-wizard/jquery.form.wizard.js
@@ -13,7 +13,7 @@
(function($){
- $.widget("ui.formwizard", {
+ $.widget("ui.formwizard", {
_init: function() {
@@ -141,10 +141,25 @@
this.backButton.addClass("ui-helper-reset ui-state-default");
this.nextButton.addClass("ui-helper-reset ui-state-default");
}
- this._show(undefined);
+ this._show(undefined);
return $(this);
},
+ _updateFormWizardClass: function() {
+ var newClass = this.currentStep;
+ var prefix = "formwizard-";
+
+ // Remove earlier classes
+ $.each(wizard[0].classList, function(i, className){
+ if (className.startsWith(prefix)) {
+ wizard.removeClass(className);
+ }
+ });
+
+ // Add new class
+ wizard.addClass(prefix + newClass);
+ },
+
_next : function(){
if(this.options.validationEnabled){
if(!this.element.valid()){
@@ -185,7 +200,7 @@
}
}
- return this._continueToNextStep();
+ return this._continueToNextStep();
},
_back : function(){
@@ -334,10 +349,14 @@
}
if(this.currentStep !== step || step === this.firstStep){
- this.previousStep = this.currentStep;
+ this.previousStep = this.currentStep;
this._checkIflastStep(step);
this.currentStep = step;
var stepShownCallback = function(){if(triggerStepShown)$(this.element).trigger('step_shown', $.extend({"isBackNavigation" : backwards},this._state()));};
+
+ // Ron Gross
+ this._updateFormWizardClass();
+
this._animate(this.previousStep, step, stepShownCallback);
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment