1.0.0 • Published 8 years ago

jquery.stepper v1.0.0

Weekly downloads
1
License
GPL-3.0+
Repository
github
Last release
8 years ago

jquery.stepper

Shows DOM-elements sequentially with forward and back buttons and events.

Features

  • Arbitrary DOM-elements can be configured as a series and displayed sequentially
  • Automatic Forward/back-button hiding/display and events for the first and last page
  • Events before and after step switch, for example to set different headings per step or other custom actions
  • Unlimited number of steppers per page
  • Steps can be shared between series and multiple stepper instances
  • Series configuration can optionally be made with CSS-classes alone
  • Show/hide of one or multiple elements per step
  • No encapsulating Container necessary
  • Step switch Animation

Dependencies

  • jQuery

Usage

The default is to use elements with class step in the order defined by additional classes stepN. For example step1, step2, et cetera Elements with the class "nextStep" or "prevStep" get the corresponding button-functionality

Example

$(function () {
	var stepper = $('#stepper').stepper()
	stepper.showStep(1)
})

An example stepper container HTML-structure with a series of steps configured using CSS-classes:

  div#stepper
    div.step.step1
      div.nextStep
    div.step.step2
      div.prevStep
      div.nextStep
    div.step.step3
      div.nextStep
    ...

Options

optionNamedescriptionoptionValue
stepConfigTo set step containers and order manually{stepNumber: jqueryObject, ...}
animationAnimation when changing stepsjQuery animation name
animationSpeedMillisecond duration for the animationinteger
onStepChangeMust return a true value, otherwise the step change is aborted. Example use case: validation.function(from, to, stepper, nextStep)
onAfterStepChangeCalled after the next step element has been displayedfunction(from, to, stepper, nextStep)
forwardButtonFor retrieving the forwardButton by jQuery-selector, jQuery-object or functionstring, jQuery, function(step)
backButtonFor retrieving the backButton by jQuery-selector, jQuery-object or functionstring, jQuery, function(step)
autoHideBackForwardIf true, hides the back button on the first step and the forward button on the last step. The default is "true"boolean

Methods

  • showStep(number, boolean) - if the second argument is a true value, then the onStepChange and onAfterStepChange events are not triggered
  • hideAll()
  • showFirstStepThatContains(selector)
  • nextStep()
  • prevStep()
  • get(number)
  • disableButtonEvents()
  • enableButtonEvents()