Closed derekm closed 3 years ago
I also had this issue. It's even weirder: when introJs().goToStep(2).start()
is the first call to introJs it works correct, but if introJs was started before then it starts the wrong step.
I'm also having this issue. Let's say on page 1, the last data-step I have is 6.
On the next page, if I do something like this:
// To pick up the Intro.js where it left off
if (RegExp('multipage', 'gi').test(window.location.search)) {
introJs().goToStep(7).setOption('doneLabel', 'Next page').start().oncomplete(function() {
window.location.href = 'thenextpage.html?multipage=true'
});
}
introJs fades the background but then fades back in. Almost like it's not seeing step 7.
In order to get it to "work", I set it to step 6 (the last step on the previous page), and then it somehow finds step 7. This breaks the "back" functionality in the intro, though.
@derekm Thanks a lot for posting this.
Using IntroJS v2.0.0
I have this very issue: I am never able to start from step 1 if I do:
introJs().goToStep(1).start();
This would start from step 2.
introJs().start().goToStep(6);
Doing the opposite as above never actually goes to the target step 6. Just remains on step 1.
Any suggestions how to fix this.
Here is the code for Multiple steps.
var introProfileClass = introJs();
introProfileClass.setOptions({});
var step = $(this).data('step');
if (step == 1) {
introProfileClass.start();
}else {
introProfileClass.goToStep(step-1).start();
}
I think there might be an issue with how GoToStep works, or at least it's a little counterintuitive to me. It works on the queued steps, and it's 0 indexed. goToStepNumber() might be what you want.
I am using Intro.js v2.7.0 and the following code worked for me:
introJs().start().goToStep(4); // go to step 4
introJs().start().goToStep(4);
//it is worked for me
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Similar issue with v 3.3.1
. I'm saving the last step using getCurrentStep()
on exit
to localstorage. If I start the tour again, it correctly loads the step from localstorage
, but if I refresh and try it, it somehow calls complete()
and exit()
and starts from step one again. My code:
// this.tour = introJs();
this.tour.oncomplete(() => {
console.log('onComplete() called');
});
this.tour.onexit(() => {
// save the step so the user can continue where the left off if they decide to revisit the step
// (omitted for brevity)
Tour.saveStep(this.tour.currentStep(), this.tourID);
console.log('onexit() called');
});
const lastStep = localStorage.getItem(`${tourID}_tour-step`);
let startFromBeginning = false;
if (lastStep === null || lastStep == 0 || lastStep > this.steps.length) {
startFromBeginning = true;
}
if (startFromBeginning) {
// works fine
this.tour.start();
} else {
// works fine, but not after a page refresh
this.tour.goToStepNumber(lastStep).start();
}
Also worth noting that I've had to dick about with goToStepNumber()
, goToStep()
and start()
, using them interchangeably and can't get a reliable result.
The following code sample in the docs isn't working for me:
introJs().goToStep(2).start(); //starts introduction from step 2
I have to call introJs().start().goToStep(2).
The documented call pattern causes IntroJS to go to the step after the step I've indicated (the final start() re-initializes the helper dialog to the next step after the indicated step has been rendered).
It's 2022 - and I had this issue as well. This workaround still works, thanks :)
The following code sample in the docs isn't working for me:
I have to call introJs().start().goToStep(2).
The documented call pattern causes IntroJS to go to the step after the step I've indicated (the final start() re-initializes the helper dialog to the next step after the indicated step has been rendered).