Skip to content

Commit f691363

Browse files
author
Rafael J. Staib
committed
Add some infos for new features
1 parent 8545e50 commit f691363

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed

jquery.steps.js

+47-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery Steps Plugin v0.9.5 - A powerful jQuery wizard plugin that supports accessibility and HTML5
2+
* jQuery Steps Plugin v0.9.6b - A powerful jQuery wizard plugin that supports accessibility and HTML5
33
* https://github.com/rstaib/jquery-steps
44
*
55
* Copyright (c) 2013 Rafael J. Staib
@@ -25,12 +25,14 @@
2525
* - Implement functionality to skip a certain amount of steps
2626
* - Dynamic settings change
2727
* - Dynamic step update
28+
* - Save Step State to a cookie
29+
* - Jump from any page to a specific step
2830
*
2931
*/
3032

3133
/**
3234
* @module jQuery.steps
33-
* @requires jQuery
35+
* @requires jQuery (always required), jQuery.cookie (only required if saveState is `true`)
3436
*/
3537
(function ($)
3638
{
@@ -351,7 +353,18 @@
351353
forceMoveForward: false,
352354

353355
/**
354-
* The position to start (zero-based).
356+
* Saves the current state (step position) to a cookie.
357+
* By coming next time the last active step becomes activated.
358+
*
359+
* @property saveState
360+
* @type Boolean
361+
* @default false
362+
* @for defaults
363+
**/
364+
saveState: false,
365+
366+
/**
367+
* The position to start on (zero-based).
355368
*
356369
* @property startIndex
357370
* @type Integer
@@ -365,7 +378,7 @@
365378
*/
366379

367380
/**
368-
* The animation effect which should be used for step transitions.
381+
* The animation effect which will be used for step transitions.
369382
*
370383
* @property transitionEffect
371384
* @type transitionEffect
@@ -375,7 +388,7 @@
375388
transitionEffect: $.fn.steps.transitionEffect.none,
376389

377390
/**
378-
* The animation speed for step transitions (in milliseconds).
391+
* Animation speed for step transitions (in milliseconds).
379392
*
380393
* @property transitionEffectSpeed
381394
* @type Integer
@@ -1337,13 +1350,39 @@
13371350
* @private
13381351
* @method getUniqueId
13391352
* @param wizard {Object} A jQuery wizard object
1340-
* @return {String} Returns the unique for the given wizard
1353+
* @return {String} Returns the unique id for the given wizard
13411354
*/
13421355
function getUniqueId(wizard)
13431356
{
13441357
return wizard.data("uid");
13451358
}
13461359

1360+
/**
1361+
* Gets the current unique step id by the given step anchor DOM element.
1362+
*
1363+
* @private
1364+
* @method getUniqueStepId
1365+
* @param anchor {Object} The step anchor DOM element
1366+
* @return {String} Returns the unique step id
1367+
*/
1368+
function getUniqueStepId(anchor)
1369+
{
1370+
return anchor.attr("href").substring(anchor.attr("href").lastIndexOf("#"));
1371+
}
1372+
1373+
/**
1374+
* Gets the step position (zero-based) by the given step anchor DOM element.
1375+
*
1376+
* @private
1377+
* @method getStepPosition
1378+
* @param anchor {Object} The step anchor DOM element
1379+
* @return {String} Returns the step position
1380+
*/
1381+
function getStepPosition(anchor)
1382+
{
1383+
return Number(anchor.attr("href").substring(anchor.attr("href").lastIndexOf("-") + 1));
1384+
}
1385+
13471386
/**
13481387
* Handles the keyup DOM event.
13491388
*
@@ -1386,7 +1425,7 @@
13861425

13871426
var anchor = $(this),
13881427
wizard = anchor.parents(".wizard");
1389-
switch (anchor.attr("href").substring(anchor.attr("href").lastIndexOf("#")))
1428+
switch (getUniqueStepId(anchor))
13901429
{
13911430
case "#finish":
13921431
wizard.steps("finish");
@@ -1420,7 +1459,7 @@
14201459

14211460
if (anchor.parent().is(":not(.disabled):not(.current)"))
14221461
{
1423-
goToStep(wizard, Number(anchor.attr("href").substring(anchor.attr("href").lastIndexOf("-") + 1)));
1462+
goToStep(wizard, getStepPosition(anchor));
14241463
}
14251464

14261465
// If nothing has changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jQuery-steps",
33
"title": "jQuery Wizard Plugin",
4-
"version": "0.9.5",
4+
"version": "0.9.6b",
55
"description": "A powerful jQuery wizard plugin that supports accessibility and HTML5",
66
"homepage": "https://github.com/rstaib/jquery-steps",
77
"author": {

0 commit comments

Comments
 (0)