Skip to content
Open
Show file tree
Hide file tree
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
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ $('#wizard').smartWizard({
onLeaveStep: null, // triggers when leaving a step
onShowStep: null, // triggers when showing a step
onFinish: null, // triggers when Finish button is clicked
includeFinishButton : true // Add the finish button
includeFinishButton : true, // Add the finish button
includePreviousButton: true // Add the prevous button
});
```

Expand Down Expand Up @@ -431,6 +432,16 @@ example:
</td>
<td>true</td>
</tr>
<tr>
<td><strong>includePreviousButton</strong></td>
<td>If true, adds a previous button</td>
<td>
true = show
<br />
false= don't show
</td>
<td>true</td>
</tr>

</table>

Expand Down
31 changes: 20 additions & 11 deletions js/jquery.smartWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* http://www.techlaboratory.net
* http://tech-laboratory.blogspot.com
*/

(function($){

function SmartWizard(target, options) {
this.target = target;
Expand Down Expand Up @@ -285,17 +287,23 @@ function SmartWizard(target, options) {

var _adjustButton = function($this) {
if (! $this.options.cycleSteps){
if (0 >= $this.curStepIdx) {
$($this.buttons.previous).addClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
$($this.buttons.previous).hide();
}
}else{
$($this.buttons.previous).removeClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
$($this.buttons.previous).show();
if($this.options.includePreviousButton){
if (0 >= $this.curStepIdx) {
$($this.buttons.previous).addClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
$($this.buttons.previous).hide();
}
}else{
$($this.buttons.previous).removeClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
$($this.buttons.previous).show();
}
}
}
else{
$($this.buttons.previous).hide();
}

if (($this.steps.length-1) <= $this.curStepIdx){
$($this.buttons.next).addClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
Expand Down Expand Up @@ -434,7 +442,7 @@ function SmartWizard(target, options) {



(function($){


$.fn.smartWizard = function(method) {
var args = arguments;
Expand Down Expand Up @@ -483,7 +491,8 @@ function SmartWizard(target, options) {
onLeaveStep: null, // triggers when leaving a step
onShowStep: null, // triggers when showing a step
onFinish: null, // triggers when Finish button is clicked
includeFinishButton : true // Add the finish button
includeFinishButton : true, // Add the finish button
includePreviousButton: true // Add the prevous button
};

})(jQuery);