Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getCurrentStep in onShow method returns 0 for first two steps #484

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build/js/bootstrap-tour-standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@
$element = $('body');
}
$element.popover('destroy').removeClass("tour-" + _this._options.name + "-element tour-" + _this._options.name + "-" + i + "-element");
$element.data('bs.popover', null);
if (step.reflex) {
$(step.reflexElement).removeClass('tour-step-element-reflex').off("" + (_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name);
}
Expand All @@ -923,11 +924,11 @@
return;
}
skipToPrevious = i < this._current;
this.setCurrentStep(i);
promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);
showStepHelper = (function(_this) {
return function(e) {
var path, showPopoverAndOverlay;
_this.setCurrentStep(i);
path = (function() {
switch ({}.toString.call(step.path)) {
case '[object Function]':
Expand Down
2 changes: 1 addition & 1 deletion build/js/bootstrap-tour-standalone.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion build/js/bootstrap-tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
$element = $('body');
}
$element.popover('destroy').removeClass("tour-" + _this._options.name + "-element tour-" + _this._options.name + "-" + i + "-element");
$element.data('bs.popover', null);
if (step.reflex) {
$(step.reflexElement).removeClass('tour-step-element-reflex').off("" + (_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name);
}
Expand All @@ -291,11 +292,11 @@
return;
}
skipToPrevious = i < this._current;
this.setCurrentStep(i);
promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);
showStepHelper = (function(_this) {
return function(e) {
var path, showPopoverAndOverlay;
_this.setCurrentStep(i);
path = (function() {
switch ({}.toString.call(step.path)) {
case '[object Function]':
Expand Down
2 changes: 1 addition & 1 deletion build/js/bootstrap-tour.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/coffee/bootstrap-tour.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,12 @@

skipToPrevious = i < @_current

@setCurrentStep i

# If onShow returns a promise, let's wait until it's done to execute
promise = @_makePromise(step.onShow @, i if step.onShow?)

showStepHelper = (e) =>
@setCurrentStep i

# Support string or function for path
path = switch ({}).toString.call step.path
when '[object Function]' then step.path()
Expand Down
3 changes: 2 additions & 1 deletion src/docs/assets/js/bootstrap-tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
$element = $('body');
}
$element.popover('destroy').removeClass("tour-" + _this._options.name + "-element tour-" + _this._options.name + "-" + i + "-element");
$element.data('bs.popover', null);
if (step.reflex) {
$(step.reflexElement).removeClass('tour-step-element-reflex').off("" + (_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name);
}
Expand All @@ -291,11 +292,11 @@
return;
}
skipToPrevious = i < this._current;
this.setCurrentStep(i);
promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);
showStepHelper = (function(_this) {
return function(e) {
var path, showPopoverAndOverlay;
_this.setCurrentStep(i);
path = (function() {
switch ({}.toString.call(step.path)) {
case '[object Function]':
Expand Down
3 changes: 2 additions & 1 deletion test/bootstrap-tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
$element = $('body');
}
$element.popover('destroy').removeClass("tour-" + _this._options.name + "-element tour-" + _this._options.name + "-" + i + "-element");
$element.data('bs.popover', null);
if (step.reflex) {
$(step.reflexElement).removeClass('tour-step-element-reflex').off("" + (_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name);
}
Expand All @@ -291,11 +292,11 @@
return;
}
skipToPrevious = i < this._current;
this.setCurrentStep(i);
promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0);
showStepHelper = (function(_this) {
return function(e) {
var path, showPopoverAndOverlay;
_this.setCurrentStep(i);
path = (function() {
switch ({}.toString.call(step.path)) {
case '[object Function]':
Expand Down