Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

How to create multiple tours on one page? #372

Open
myshaadi opened this issue Oct 19, 2018 · 5 comments
Open

How to create multiple tours on one page? #372

myshaadi opened this issue Oct 19, 2018 · 5 comments

Comments

@myshaadi
Copy link

Hi,

I am working on an app where I am using Hopscotch for the main tour when a user first enters the page. However, I am trying to find a way to implement a second tour on the same page, this time when the user does a certain action like click on a button.

I can't seem to find anything online for this... is it possible?

Thanks

@sneakyfildy
Copy link

sneakyfildy commented Oct 19, 2018

http://linkedin.github.io/hopscotch
Pls read the first article. It describes, how defined tour can be started. Just run hopscotch.startTour(secondDefinedTour) anytime and that's all. Having secondDefinedTour defined of course

@FallenRo
Copy link

I have the same problem as myshaadi. When I attempt to a second tour inside the onEnd() function of the first tour nothing happens. I've googled this but I found no relevant results other than this ticket.

@sneakyfildy as far as I can see, there is nothing in the documentation about linking two tours together, in the same page.. or maybe I am missing something?

Can anybody help?

Thanks!

@sneakyfildy
Copy link

sneakyfildy commented Oct 29, 2018

The nature of your trouble is that hopscotch fires "onEnd" callback actually "while" doing "end" sequence, so it is not possible to start a new tour w/o hacks (via default "startTour" method).
What you need to do is simply take out "startTour" call from synchronous execution flow by using setTimeout

https://jsfiddle.net/cmk0ozaL/9/

inspect "onTour1End_working" function and "onTour1End_not_working" one.

N.B. first usage of "setTimeout" has no technical reason, just to be able to put the call in the beginning of a script. Ignore it.

@FallenRo
Copy link

That worked! Thank you very much for replying this fast!

@sneakyfildy
Copy link

I guess you should close the ticket

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants