Skip to content
Version:

jQuery SmartWizard v4

The awesome jQuery step wizard plugin with Bootstrap support


Unmaintained Version

This version is not maintained anymore. Please use the latest version.

Smart Wizard is a flexible and heavily customizable jQuery step wizard plugin with Bootstrap support.

Installation

NPM

bash
npm install smartwizard@4.4.1

Yarn

bash
yarn add smartwizard@4.4.1

Bower

bash
bower install smartwizard#4.4.1

Composer

bash
composer require techlab/smartwizard:4.4.1

CDN - jsDelivr

html
<!-- CSS -->
<link href="https://cdn.jsdelivr.net/npm/smartwizard@4.4.1/dist/css/smart_wizard.min.css" rel="stylesheet" type="text/css" />

<!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/smartwizard@4.4.1/dist/js/jquery.smartWizard.min.js" type="text/javascript"></script>

CDN - UNPKG

html
<!-- CSS -->
<link href="https://unpkg.com/smartwizard@4.4.1/dist/css/smart_wizard.min.css" rel="stylesheet" type="text/css" />

<!-- JavaScript -->
<script src="https://unpkg.com/smartwizard@4.4.1/dist/js/jquery.smartWizard.min.js" type="text/javascript"></script>

Download

Download jQuery Smart Wizard v4.4.1

Features

  • Bootstrap 3 & 4 support
  • Responsive themes
  • Heavily customizable toolbar, option to add extra buttons
  • Theme support with various themes included
  • Customizable css styles
  • Url navigation and step selection
  • Public methods for external function call
  • Enhanced event support
  • In-built reset method
  • Dynamically hide or disable steps
  • Integratable to model window
  • Ajax content loading with option to specify individual url for steps
  • Keyboard navigation
  • Easy navigation with step anchors and navigation buttons
  • Multiple wizard instance on same page
  • Auto content height adjustment
  • Compatible with latest jQuery versions (jQuery 1.9+, jQuery 2+, jQuery 3+)
  • Easy to implement, Minimal HTML required

Documentation

Requirements

  1. Bootstrap 3+
  2. jQuery (supports jQuery 1.9+, jQuery 2+, jQuery 3+)

Include Smart Wizard JavaScript & CSS files

html
<link href="../dist/css/smart_wizard.css" rel="stylesheet" type="text/css" />
<script src="../dist/js/jquery.smartWizard.min.js" type="text/javascript"></script>

For themed version:

html
<link href="../dist/css/smart_wizard_theme_arrows.css" rel="stylesheet" type="text/css" />

Initialize Smart Wizard

javascript
$(document).ready(function(){
  $('#smartwizard').smartWizard();
});

The HTML Markup

html
<div id="smartwizard">
  <ul>
    <li><a href="#step-1">Step Title<br /><small>Step description</small></a></li>
    <li><a href="#step-2">Step Title<br /><small>Step description</small></a></li>
    <li><a href="#step-3">Step Title<br /><small>Step description</small></a></li>
    <li><a href="#step-4">Step Title<br /><small>Step description</small></a></li>
  </ul>

  <div>
    <div id="step-1">Step Content</div>
    <div id="step-2">Step Content</div>
    <div id="step-3">Step Content</div>
    <div id="step-4">Step Content</div>
  </div>
</div>

Configuration

Example: Smart Wizard Initialize with all option parameters

javascript
$('#smartwizard').smartWizard({
  selected: 0, // Initial selected step, 0 = first step
  keyNavigation: true, // Enable/Disable keyboard navigation
  autoAdjustHeight: true, // Automatically adjust content height
  cycleSteps: false, // Allows to cycle the navigation of steps
  backButtonSupport: true, // Enable the back button support
  useURLhash: true, // Enable selection of the step based on url hash
  lang: {
    next: 'Next',
    previous: 'Previous'
  },
  toolbarSettings: {
    toolbarPosition: 'bottom', // none, top, bottom, both
    toolbarButtonPosition: 'right', // left, right
    showNextButton: true,
    showPreviousButton: true,
    toolbarExtraButtons: [
      $('<button></button>').text('Finish')
        .addClass('btn btn-info')
        .on('click', function(){
          alert('Finish button click');
        }),
      $('<button></button>').text('Cancel')
        .addClass('btn btn-danger')
        .on('click', function(){
          alert('Cancel button click');
        })
    ]
  },
  anchorSettings: {
    anchorClickable: true,
    enableAllAnchors: false,
    markDoneStep: true,
    enableAnchorOnDoneStep: true
  },
  contentURL: null, // Enables Ajax content loading
  disabledSteps: [],
  errorSteps: [],
  theme: 'dots',
  transitionEffect: 'fade', // none/slide/fade
  transitionSpeed: '400'
});

Parameters

Core Parameters

ParameterDescriptionValuesDefault
selectedSpecify the selected step on the first loadinteger0
keyNavigationEnable/disable key navigation (left/right keys are used if enabled)true/falsetrue
autoAdjustHeightAutomatically adjust content heighttrue/falsetrue
cycleStepsAllows to cycle the navigation of stepstrue/falsefalse
backButtonSupportEnable the back button supporttrue/falsetrue
useURLhashEnable selection of the step based on url hashtrue/falsetrue
showStepURLhashShow url hash based on steptrue/falsetrue
themeName of the theme to use (remember to include the theme CSS)String'default'
transitionEffectAnimation effect on step navigationnone/slide/fadenone
transitionSpeedTransition animation speedNumber or String400

Ajax Content Parameters

ParameterDescriptionValuesDefault
contentURLSpecify the ajax content url. Setting null will disable ajax contents. You can also add a data-content-url attribute to individual step anchorsnull or valid URLnull
contentCacheEnable/disable caching of step contents on ajax calls. If false, content is fetched always from ajax urltrue/falsetrue
ajaxSettingsProvide extra settings for step ajax content callsObject as per jQuery.ajax(){}

Step State Parameters

ParameterDescriptionValuesDefault
disabledStepsAn array of step numbers to show as disabledZero-based array of step index (e.g., [2, 4])[]
errorStepsAn array of step numbers to show as error stepsZero-based array of step index (e.g., [2, 4])[]
hiddenStepsAn array of step numbers to be hiddenZero-based array of step index (e.g., [2, 4])[]

Toolbar Settings

The toolbarSettings parameter is an object with the following properties:

ParameterDescriptionDefault
toolbarPositionPosition of the toolbar'bottom' (options: none, top, bottom, both)
toolbarButtonPositionPosition of the toolbar buttons'right' (options: left, right)
showNextButtonShow/hide the Next buttontrue
showPreviousButtonShow/hide the Previous buttontrue
toolbarExtraButtonsSpecify extra buttons and their events to show on toolbar[]

Anchor Settings

The anchorSettings parameter is an object with the following properties:

ParameterDescriptionDefault
anchorClickableEnable or disable the click option on the step header anchorstrue
enableAllAnchorsEnable all anchors on loadfalse
markDoneStepMark already visited steps as donetrue
markAllPreviousStepsAsDoneWhen a step is selected by url hash, all previous steps are marked donetrue
removeDoneStepOnNavigateBackWhile navigating back, done step after active step will be clearedfalse
enableAnchorOnDoneStepEnable/disable the done steps navigationtrue

Language Settings

The lang parameter is an object with the following properties:

ParameterDescriptionDefault
nextText for next button'Next'
previousText for previous button'Previous'

Events

Event Descriptions

EventDescriptionParameters
leaveStepTriggers when leaving a step. This is a decision-making event - based on its function return value (true/false), the current step navigation can be cancelled.Object: object of the step anchor element
Int: Index of the step
String: Direction of the navigation (e.g., forward, backward)
showStepTriggers when showing a step.Object: object of the step anchor element
Int: Index of the step
String: Direction of the navigation (e.g., forward, backward). Passes empty string on page load and reset.
beginResetTriggers when reset action starts. This is a decision-making event - based on its function return value (true/false), the reset action can be cancelled.None
endResetTriggers when reset action ends.None
themeChangedTriggers when theme is changed.String: name of the theme

Event Initialize

javascript
// Initialize Smart Wizard
$('#smartwizard').smartWizard();

// Initialize the leaveStep event
$("#smartwizard").on("leaveStep", function(e, anchorObject, stepNumber, stepDirection) {
  return confirm("Do you want to leave the step " + stepNumber + "?");
});

// Initialize the showStep event
$("#smartwizard").on("showStep", function(e, anchorObject, stepNumber, stepDirection) {
  alert("You are on step " + stepNumber + " now");
});

// Initialize the beginReset event
$("#smartwizard").on("beginReset", function(e) {
  return confirm("Do you want to reset the wizard?");
});

// Initialize the endReset event
$("#smartwizard").on("endReset", function(e) {
  alert("endReset called");
});

// Initialize the themeChanged event
$("#smartwizard").on("themeChanged", function(e, theme) {
  alert("Theme changed. New theme name: " + theme);
});

License

Released under the terms of the MIT License.