Skip to content

Commit 19f1fc5

Browse files
committed
Fixed issue #91
1 parent a05a911 commit 19f1fc5

11 files changed

+35
-30
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 1.0.8
4+
- Fixed issue [#91](https://github.com/rstaib/jquery-steps/issues/91) (`stepChanged` event is fired before transitions are done)
5+
36
## 1.0.7
47
- Small fix. Closes issue [#58](https://github.com/rstaib/jquery-steps/issues/58)
58
- Set the default value of `enableCancelButton` for backward compatibility reasons to `false`

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"tabs",
1414
"steps"
1515
],
16-
"version": "1.0.7",
16+
"version": "1.0.8",
1717
"authors": [
1818
{ "name": "Rafael Staib", "email": "me@rafaelstaib.com", "url": "http://www.rafaelstaib.com" }
1919
],

build/jQuery.Steps.1.0.7.nupkg

-19.4 KB
Binary file not shown.

build/jQuery.Steps.1.0.8.nupkg

19.5 KB
Binary file not shown.

build/jquery.steps-1.0.7.zip

-18.7 KB
Binary file not shown.

build/jquery.steps-1.0.8.zip

18.8 KB
Binary file not shown.

build/jquery.steps.js

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery Steps v1.0.7 - 05/07/2014
2+
* jQuery Steps v1.0.8 - 09/01/2014
33
* Copyright (c) 2014 Rafael Staib (http://www.jquery-steps.com)
44
* Licensed under MIT http://www.opensource.org/licenses/MIT
55
*/
@@ -510,9 +510,10 @@ function goToStep(wizard, options, state, index)
510510
refreshStepNavigation(wizard, options, state, oldIndex);
511511
refreshPagination(wizard, options, state);
512512
loadAsyncContent(wizard, options, state);
513-
startTransitionEffect(wizard, options, state, index, oldIndex);
514-
515-
wizard.triggerHandler("stepChanged", [index, oldIndex]);
513+
startTransitionEffect(wizard, options, state, index, oldIndex, function()
514+
{
515+
wizard.triggerHandler("stepChanged", [index, oldIndex]);
516+
});
516517
}
517518
else
518519
{
@@ -1184,7 +1185,7 @@ function saveCurrentStateToCookie(wizard, options, state)
11841185
}
11851186
}
11861187

1187-
function startTransitionEffect(wizard, options, state, index, oldIndex)
1188+
function startTransitionEffect(wizard, options, state, index, oldIndex, doneCallback)
11881189
{
11891190
var stepContents = wizard.find(".content > .body"),
11901191
effect = getValidEnumValue(transitionEffect, options.transitionEffect),
@@ -1210,26 +1211,26 @@ function startTransitionEffect(wizard, options, state, index, oldIndex)
12101211
state.transitionElement[show](effectSpeed, function ()
12111212
{
12121213
$(this)._showAria();
1213-
});
1214+
}).promise().done(doneCallback);
12141215
state.transitionElement = null;
12151216
}
1216-
}).promise();
1217+
});
12171218
break;
12181219

12191220
case transitionEffect.slideLeft:
12201221
var outerWidth = currentStep.outerWidth(true),
12211222
posFadeOut = (index > oldIndex) ? -(outerWidth) : outerWidth,
12221223
posFadeIn = (index > oldIndex) ? outerWidth : -(outerWidth);
12231224

1224-
currentStep.animate({ left: posFadeOut }, effectSpeed,
1225-
function () { $(this)._showAria(false); }).promise();
1226-
newStep.css("left", posFadeIn + "px")._showAria()
1227-
.animate({ left: 0 }, effectSpeed).promise();
1225+
$.when(currentStep.animate({ left: posFadeOut }, effectSpeed,
1226+
function () { $(this)._showAria(false); }),
1227+
newStep.css("left", posFadeIn + "px")._showAria()
1228+
.animate({ left: 0 }, effectSpeed)).done(doneCallback);
12281229
break;
12291230

12301231
default:
1231-
currentStep._showAria(false);
1232-
newStep._showAria();
1232+
$.when(currentStep._showAria(false), newStep._showAria())
1233+
.done(doneCallback);
12331234
break;
12341235
}
12351236
}

build/jquery.steps.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jquery-steps",
33
"title": "jQuery Steps",
4-
"version": "1.0.7",
4+
"version": "1.0.8",
55
"description": "A powerful jQuery wizard plugin that supports accessibility and HTML5",
66
"homepage": "http://www.jquery-steps.com",
77
"author": {

src/privates.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,10 @@ function goToStep(wizard, options, state, index)
450450
refreshStepNavigation(wizard, options, state, oldIndex);
451451
refreshPagination(wizard, options, state);
452452
loadAsyncContent(wizard, options, state);
453-
startTransitionEffect(wizard, options, state, index, oldIndex);
454-
455-
wizard.triggerHandler("stepChanged", [index, oldIndex]);
453+
startTransitionEffect(wizard, options, state, index, oldIndex, function()
454+
{
455+
wizard.triggerHandler("stepChanged", [index, oldIndex]);
456+
});
456457
}
457458
else
458459
{
@@ -1124,7 +1125,7 @@ function saveCurrentStateToCookie(wizard, options, state)
11241125
}
11251126
}
11261127

1127-
function startTransitionEffect(wizard, options, state, index, oldIndex)
1128+
function startTransitionEffect(wizard, options, state, index, oldIndex, doneCallback)
11281129
{
11291130
var stepContents = wizard.find(".content > .body"),
11301131
effect = getValidEnumValue(transitionEffect, options.transitionEffect),
@@ -1150,26 +1151,26 @@ function startTransitionEffect(wizard, options, state, index, oldIndex)
11501151
state.transitionElement[show](effectSpeed, function ()
11511152
{
11521153
$(this)._showAria();
1153-
});
1154+
}).promise().done(doneCallback);
11541155
state.transitionElement = null;
11551156
}
1156-
}).promise();
1157+
});
11571158
break;
11581159

11591160
case transitionEffect.slideLeft:
11601161
var outerWidth = currentStep.outerWidth(true),
11611162
posFadeOut = (index > oldIndex) ? -(outerWidth) : outerWidth,
11621163
posFadeIn = (index > oldIndex) ? outerWidth : -(outerWidth);
11631164

1164-
currentStep.animate({ left: posFadeOut }, effectSpeed,
1165-
function () { $(this)._showAria(false); }).promise();
1166-
newStep.css("left", posFadeIn + "px")._showAria()
1167-
.animate({ left: 0 }, effectSpeed).promise();
1165+
$.when(currentStep.animate({ left: posFadeOut }, effectSpeed,
1166+
function () { $(this)._showAria(false); }),
1167+
newStep.css("left", posFadeIn + "px")._showAria()
1168+
.animate({ left: 0 }, effectSpeed)).done(doneCallback);
11681169
break;
11691170

11701171
default:
1171-
currentStep._showAria(false);
1172-
newStep._showAria();
1172+
$.when(currentStep._showAria(false), newStep._showAria())
1173+
.done(doneCallback);
11731174
break;
11741175
}
11751176
}

steps.jquery.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"tabs",
1515
"steps"
1616
],
17-
"version": "1.0.7",
17+
"version": "1.0.8",
1818
"author": {
1919
"name": "Rafael Staib",
2020
"email": "me@rafaelstaib.com",

0 commit comments

Comments
 (0)