Ads

Sunday, 27 July 2014

jQuery Steps - A powerful wizard plugin

Download   Demo


jQuery Steps is a smart UI component which allows you to easily create wizard-like interfaces. This plugin groups content into sections for a more structured and orderly page view. Furthermore, it is as simple as 1-2-3 to add plugins such as jQuery Validation which can prevent step changing or submission.


Features



Accessability support

Make it visible for everyone without extra work – just use it.

Async content loading

Load your content asynchronously via AJAX by calling e.g. aREST service.

Cool transition effects

Beautiful & sleek transition effects complete the offer.

Dynamic Manipulation

Add or remove steps dynamically via API.

Easy Navigation

Navigate in various different way using the keyboard, steps or pager – it is up to you.

State Persistence

Enable the saveState option – this will save your current step position of each individual wizard *.

Form validation made easy

Embed a validation plugin of your choice and customize it like you want – it is just that simple.

Embedded iframe content

Embed your content via an iframe - it feels like it would be a part of your site.

Keyboard navigation

Use your keyboard to navigate through your content.

Multiple wizards

Have multiple wizards on one page or even have nested wizards like you want.

Vertical Navigation

Switch to vertical navigation if you need.

And much more …

Take a look to the examples and learn more about it.


1. INCLUDE JS FILES
<script src="jquery.js"></script> 
<script src="jquery.steps.js"></script>

2. HTML


<div id="wizard">
<h1>First Step</h1>
<div>First Content</div>

<h1>Second Step</h1>
<div>Second Content</div>
</div>

3. JAVASCRIPT


 $("#wizard").steps();

4. SETTINGS


Appearance


































Setting NameDescriptionTypeDefault Value
headerTagThe header tag is used to find the step button text within the declared wizard area.Stringh1
bodyTagThe body tag is used to find the step content within the declared wizard area.Stringdiv
contentContainerTagThe content container tag which will be used to wrap all step contents.Stringdiv
actionContainerTagThe action container tag which will be used to wrap the pagination navigation.Stringdiv
stepsContainerTagThe steps container tag which will be used to wrap the steps navigation.Stringdiv
cssClassThe css class which will be added to the outer component wrapper.Stringwizard
stepsOrientationDetermines whether the steps are vertically or horizontally oriented.String or Integerhorizontalor 0

Templates














Setting NameDescriptionTypeDefault Value
titleTemplateThe title template which will be used to create a step button.String<span class=”number”>#index#.</span> #title#
loadingTemplateThe loading template which will be used to create the loading animation.String<span class=”spinner”></span> #text#

Behaviour






















































Setting NameDescriptionTypeDefault Value
autoFocusSets the focus to the first wizard instance in order to enable the key navigation from the begining iftrue.Booleanfalse
enableAllStepsEnables all steps from the begining if true (all steps are clickable).Booleanfalse
enableKeyNavigationEnables keyboard navigation iftrue (arrow left and arrow right).Booleantrue
enablePaginationEnables pagination (next, previous and finish button) if true.Booleantrue
suppressPaginationOnFocusSuppresses pagination if a form field is focused.Booleantrue
enableContentCacheEnables cache for async loaded or iframe embedded content.Booleantrue
enableCancelButtonShows the cancel button if enabled.Booleanfalse
enableFinishButtonShows the finish button if enabled.Booleantrue
showFinishButtonAlwaysShows the finish button always (on each step; right beside the next button) if true. Otherwise the next button will be replaced by the finish button if the last step becomes active.Booleanfalse
forceMoveForwardPrevents jumping to a previous step.Booleanfalse
saveStateSaves the current state (step position) to a cookie. By coming next time the last active step becomes activated.Booleanfalse
startIndexThe position to start on (zero-based).Integer0

Transition Effects














Setting NameDescriptionTypeDefault Value
transitionEffectThe animation effect which will be used for step transitions.String or Integernone or0
transitionEffectSpeedAnimation speed for step transitions (in milliseconds).Integer200

Events


























Setting NameDescriptionTypeDefault Value
onStepChangingFires before the step changes and can be used to prevent step changing by returningfalse. Very useful for form validation.Eventfunction (event, currentIndex, newIndex) return true;
onStepChangedFires after the step has change.Eventfunction (event, currentIndex, priorIndex)
onCanceledFires after cancelation.Eventfunction (event)
onFinishingFires before finishing and can be used to prevent completion by returning false. Very useful for form validation.Eventfunction (event, currentIndex) return true;
onFinishedFires after completion.Eventfunction (event, currentIndex)

Labels


































Setting NameDescriptionTypeDefault Value
cancelLabel for the cancel button.StringCancel
currentThis label is important for accessability reasons. Indicates which step is activated.Stringcurrent step:
paginationThis label is important for accessability reasons and describes the kind of navigation.StringPagination
finishLabel for the finish button.StringFinish
nextLabel for the next button.StringNext
previousLabel for the previous button.StringPrevious
loadingLabel for the loading animation.StringLoading …

Example



var settings = 
/* Appearance */
headerTag: "h1",
bodyTag: "div",
contentContainerTag: "div",
actionContainerTag: "div",
stepsContainerTag: "div",
cssClass: "wizard",
stepsOrientation: $.fn.steps.stepsOrientation.horizontal,

/* Templates */
titleTemplate: '<span class="number">#index#.</span> #title#',
loadingTemplate: '<span class="spinner"></span> #text#',

/* Behaviour */
autoFocus: false,
enableAllSteps: false,
enableKeyNavigation: true,
enablePagination: true,
suppressPaginationOnFocus: true,
enableContentCache: true,
enableCancelButton: true,
enableFinishButton: true,
preloadContent: false,
showFinishButtonAlways: false,
forceMoveForward: false,
saveState: false,
startIndex: 0,

/* Transition Effects */
transitionEffect: $.fn.steps.transitionEffect.none,
transitionEffectSpeed: 200,

/* Events */
onStepChanging: function (event, currentIndex, newIndex) return true; ,
onStepChanged: function (event, currentIndex, priorIndex) ,
onCanceled: function (event) ,
onFinishing: function (event, currentIndex) return true; ,
onFinished: function (event, currentIndex) ,

/* Labels */
labels:
cancel: "Cancel",
current: "current step:",
pagination: "Pagination",
finish: "Finish",
next: "Next",
previous: "Previous",
loading: "Loading ..."

};


5. STEP OBJECT


Represents an step object.






















Property NameDescriptionTypeDefault Value
titleThe step title (HTML).String“”
contentThe step content (HTML).String“”
contentModeIndicates how the content will be loaded.String or Integerhtml or 0
contentUrlThe URI that refers to the content.String“”

JavaScript Example



$("#wizard").steps("add", 
title: "Step Title",
contentMode: "async",
contentUrl: "data.xml"
);


HTML Example



<div id="wizard">
<h1>Step Title</h1>
<div data-mode="async" data-url="data.xml">
</div>
</div>


6. METHODS


















































Method NameDescriptionParametersReturn Type
addAdds a new step. (chainable)Object stepObject wizard
insertInserts a new step to a specific position. (chainable)Integer index,Object stepObject wizard
removeRemoves a specific step by an given index.Integer indexBoolean
getCurrentStepGets the current step object.-Object step
getCurrentIndexGets the current step index.-Integer
getStepGets a specific step object by index.Integer indexObject step
nextRoutes to the previous step.-Boolean
previousRoutes to the next step.-Boolean
finishTriggers the onFinishing and onFinished event.-void
destroyRemoves the control functionality completely and transforms the current state to the initial HTML structure.-void
skipSkips a certain amount of steps. Not yet implemented!Integer countBoolean

Example



$("#wizard").steps("insert", 0, 
title: "Step Title",
content: "<p>Step Body</p>"
);





jQuery Steps - A powerful wizard plugin

No comments:

Post a Comment