Basic Example
Code
HTML
<div id="example-basic"> <h3>Keyboard</h3> <section> <p>Try the keyboard navigation by clicking arrow left or right!</p> </section> <h3>Effects</h3> <section> <p>Wonderful transition effects.</p> </section> <h3>Pager</h3> <section> <p>The next and previous buttons help you to navigate through your content.</p> </section> </div>
JavaScript
$("#example-basic").steps({ headerTag: "h3", bodyTag: "section", transitionEffect: "slideLeft", autoFocus: true });
Basic Form Example
Code
HTML
<form id="example-form" action="#"> <div> <h3>Account</h3> <section> <label for="userName">User name *</label> <input id="userName" name="userName" type="text" class="required"> <label for="password">Password *</label> <input id="password" name="password" type="text" class="required"> <label for="confirm">Confirm Password *</label> <input id="confirm" name="confirm" type="text" class="required"> <p>(*) Mandatory</p> </section> <h3>Profile</h3> <section> <label for="name">First name *</label> <input id="name" name="name" type="text" class="required"> <label for="surname">Last name *</label> <input id="surname" name="surname" type="text" class="required"> <label for="email">Email *</label> <input id="email" name="email" type="text" class="required email"> <label for="address">Address</label> <input id="address" name="address" type="text"> <p>(*) Mandatory</p> </section> <h3>Hints</h3> <section> <ul> <li>Foo</li> <li>Bar</li> <li>Foobar</li> </ul> </section> <h3>Finish</h3> <section> <input id="acceptTerms" name="acceptTerms" type="checkbox" class="required"> <label for="acceptTerms">I agree with the Terms and Conditions.</label> </section> </div> </form>
JavaScript
var form = $("#example-form"); form.validate({ errorPlacement: function errorPlacement(error, element) { element.before(error); }, rules: { confirm: { equalTo: "#password" } } }); form.children("div").steps({ headerTag: "h3", bodyTag: "section", transitionEffect: "slideLeft", onStepChanging: function (event, currentIndex, newIndex) { form.validate().settings.ignore = ":disabled,:hidden"; return form.valid(); }, onFinishing: function (event, currentIndex) { form.validate().settings.ignore = ":disabled"; return form.valid(); }, onFinished: function (event, currentIndex) { alert("Submitted!"); } });
Advanced Form Example
Code
HTML
<form id="example-advanced-form" action="#"> <h3>Account</h3> <fieldset> <legend>Account Information</legend> <label for="userName-2">User name *</label> <input id="userName-2" name="userName" type="text" class="required"> <label for="password-2">Password *</label> <input id="password-2" name="password" type="text" class="required"> <label for="confirm-2">Confirm Password *</label> <input id="confirm-2" name="confirm" type="text" class="required"> <p>(*) Mandatory</p> </fieldset> <h3>Profile</h3> <fieldset> <legend>Profile Information</legend> <label for="name-2">First name *</label> <input id="name-2" name="name" type="text" class="required"> <label for="surname-2">Last name *</label> <input id="surname-2" name="surname" type="text" class="required"> <label for="email-2">Email *</label> <input id="email-2" name="email" type="text" class="required email"> <label for="address-2">Address</label> <input id="address-2" name="address" type="text"> <label for="age-2">Age (The warning step will show up if age is less than 18) *</label> <input id="age-2" name="age" type="text" class="required number"> <p>(*) Mandatory</p> </fieldset> <h3>Warning</h3> <fieldset> <legend>You are to young</legend> <p>Please go away ;-)</p> </fieldset> <h3>Finish</h3> <fieldset> <legend>Terms and Conditions</legend> <input id="acceptTerms-2" name="acceptTerms" type="checkbox" class="required"> <label for="acceptTerms-2">I agree with the Terms and Conditions.</label> </fieldset> </form>
JavaScript
var form = $("#example-advanced-form").show(); form.steps({ headerTag: "h3", bodyTag: "fieldset", transitionEffect: "slideLeft", onStepChanging: function (event, currentIndex, newIndex) { // Allways allow previous action even if the current form is not valid! if (currentIndex > newIndex) { return true; } // Forbid next action on "Warning" step if the user is to young if (newIndex === 3 && Number($("#age-2").val()) < 18) { return false; } // Needed in some cases if the user went back (clean up) if (currentIndex < newIndex) { // To remove error styles form.find(".body:eq(" + newIndex + ") label.error").remove(); form.find(".body:eq(" + newIndex + ") .error").removeClass("error"); } form.validate().settings.ignore = ":disabled,:hidden"; return form.valid(); }, onStepChanged: function (event, currentIndex, priorIndex) { // Used to skip the "Warning" step if the user is old enough. if (currentIndex === 2 && Number($("#age-2").val()) >= 18) { form.steps("next"); } // Used to skip the "Warning" step if the user is old enough and wants to the previous step. if (currentIndex === 2 && priorIndex === 3) { form.steps("previous"); } }, onFinishing: function (event, currentIndex) { form.validate().settings.ignore = ":disabled"; return form.valid(); }, onFinished: function (event, currentIndex) { alert("Submitted!"); } }).validate({ errorPlacement: function errorPlacement(error, element) { element.before(error); }, rules: { confirm: { equalTo: "#password-2" } } });
Dynamic Manipulation Example
Code
HTML
<div id="example-manipulation"> <h3>Add Step</h3> <section> <p> <label for="title-3">HTML Title *</label><br /> <input id="title-3" type="text"><br /> <label for="text-3">HTML Content *</label><br /> <textarea id="text-3" rows="5"></textarea> </p> <p><a href="javascript:void(0);" onclick="$('#wizard-4').steps('add', { title: $('#title-3').val(), content: $('#text-3').val() });">Add</a></p> <p>(*) Mandatory</p> </section> <h3>Insert Step</h3> <section> <p> <label for="position-3">Position (zero-based) *</label><br /> <input id="position-3" type="text"><br /> <label for="title2-3">HTML Title *</label><br /> <input id="title2-3" type="text"><br /> <label for="text2-3">HTML Content *</label><br /> <textarea id="text2-3" rows="5"></textarea> </p> <p><a href="javascript:void(0);" onclick="$('#wizard-4').steps('insert', Number($('#position-3').val()), { title: $('#title2-3').val(), content: $('#text2-3').val() });">Insert</a></p> <p>(*) Mandatory</p> </section> <h3>Remove Step</h3> <section> <p> <label for="position2-3">Position (zero-based) *</label><br /> <input id="position2-3" type="text"> </p> <p><a href="javascript:void(0);" onclick="$('#wizard-4').steps('remove', Number($('#position2-3').val()));">Remove</a></p> <p>(*) Mandatory</p> </section> </div>
JavaScript
$("#example-manipulation").steps({ headerTag: "h3", bodyTag: "section", enableAllSteps: true, enablePagination: false });
Tabs Example
Code
HTML
<div id="example-tabs"> <h3>Keyboard</h3> <section> <p>What is needed to transform it to a tabs component? Not much. Just override some properties and done.</p> <pre class="prettyprint linenums"> $("#wizard").steps({ // Disables the finish button (required if pagination is enabled) enableFinishButton: false, // Disables the next and previous buttons (optional) enablePagination: false, // Enables all steps from the begining enableAllSteps: true, // Removes the number from the title titleTemplate: "#title#" }); </pre> </section> <h3>Other demos</h3> <section> <p>Scroll down or up to see the other demos.</p> </section> <h3>Documentation</h3> <section> <p>For more information <a href="https://github.com/rstaib/jquery-steps/wiki">check out the documentation</a>!</p> </section> <h3>Download</h3> <section> <p>See on getting started!</p> </section> </div>
JavaScript
$("#example-tabs").steps({ headerTag: "h3", bodyTag: "section", transitionEffect: "slideLeft", enableFinishButton: false, enablePagination: false, enableAllSteps: true, titleTemplate: "#title#", cssClass: "tabcontrol" });
Vertical Steps Example
Code
HTML
<div id="example-vertical"> <h3>Keyboard</h3> <section> <p>Try the keyboard navigation by clicking arrow left or right!</p> </section> <h3>Effects</h3> <section> <p>Wonderful transition effects.</p> </section> <h3>Pager</h3> <section> <p>The next and previous buttons help you to navigate through your content.</p> </section> </div>
JavaScript
$("#example-vertical").steps({ headerTag: "h3", bodyTag: "section", transitionEffect: "slideLeft", stepsOrientation: "vertical" });
Async Content Loading Example
Code
HTML
<div id="example-async"> <h3>Async Step</h3> <section data-mode="async" data-url="/Examples/AsyncContent"> </section> <h3>Second Step</h3> <section> <p>Donec mi sapien, hendrerit nec egestas a, rutrum vitae dolor. Nullam venenatis diam ac ligula elementum pellentesque. In lobortis sollicitudin felis non eleifend. Morbi tristique tellus est, sed tempor elit. Morbi varius, nulla quis condimentum dictum, nisi elit condimentum magna, nec venenatis urna quam in nisi. Integer hendrerit sapien a diam adipiscing consectetur. In euismod augue ullamcorper leo dignissim quis elementum arcu porta. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum leo velit, blandit ac tempor nec, ultrices id diam. Donec metus lacus, rhoncus sagittis iaculis nec, malesuada a diam. Donec non pulvinar urna. Aliquam id velit lacus.</p> </section> <h3>Third Step</h3> <section> <p>Morbi ornare tellus at elit ultrices id dignissim lorem elementum. Sed eget nisl at justo condimentum dapibus. Fusce eros justo, pellentesque non euismod ac, rutrum sed quam. Ut non mi tortor. Vestibulum eleifend varius ullamcorper. Aliquam erat volutpat. Donec diam massa, porta vel dictum sit amet, iaculis ac massa. Sed elementum dui commodo lectus sollicitudin in auctor mauris venenatis.</p> </section> <h3>Fourth Step</h3> <section> <p>Quisque at sem turpis, id sagittis diam. Suspendisse malesuada eros posuere mauris vehicula vulputate. Aliquam sed sem tortor. Quisque sed felis ut mauris feugiat iaculis nec ac lectus. Sed consequat vestibulum purus, imperdiet varius est pellentesque vitae. Suspendisse consequat cursus eros, vitae tempus enim euismod non. Nullam ut commodo tortor.</p> </section> </div>
JavaScript
$("#example-async").steps({ headerTag: "h3", bodyTag: "section", transitionEffect: "slide" });
Embedded Content Example
Code
HTML
<div id="example-embed"> <h3>Iframe Step</h3> <section data-mode="iframe" data-url="/Examples/EmbeddedContent"> </section> <h3>Second Step</h3> <section> <p>Donec mi sapien, hendrerit nec egestas a, rutrum vitae dolor. Nullam venenatis diam ac ligula elementum pellentesque. In lobortis sollicitudin felis non eleifend. Morbi tristique tellus est, sed tempor elit. Morbi varius, nulla quis condimentum dictum, nisi elit condimentum magna, nec venenatis urna quam in nisi. Integer hendrerit sapien a diam adipiscing consectetur. In euismod augue ullamcorper leo dignissim quis elementum arcu porta. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum leo velit, blandit ac tempor nec, ultrices id diam. Donec metus lacus, rhoncus sagittis iaculis nec, malesuada a diam. Donec non pulvinar urna. Aliquam id velit lacus.</p> </section> <h3>Third Step</h3> <section> <p>Morbi ornare tellus at elit ultrices id dignissim lorem elementum. Sed eget nisl at justo condimentum dapibus. Fusce eros justo, pellentesque non euismod ac, rutrum sed quam. Ut non mi tortor. Vestibulum eleifend varius ullamcorper. Aliquam erat volutpat. Donec diam massa, porta vel dictum sit amet, iaculis ac massa. Sed elementum dui commodo lectus sollicitudin in auctor mauris venenatis.</p> </section> <h3>Fourth Step</h3> <section> <p>Quisque at sem turpis, id sagittis diam. Suspendisse malesuada eros posuere mauris vehicula vulputate. Aliquam sed sem tortor. Quisque sed felis ut mauris feugiat iaculis nec ac lectus. Sed consequat vestibulum purus, imperdiet varius est pellentesque vitae. Suspendisse consequat cursus eros, vitae tempus enim euismod non. Nullam ut commodo tortor.</p> </section> </div>
JavaScript
$("#example-embed").steps({ headerTag: "h3", bodyTag: "section", transitionEffect: "fade" });