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

Adds support for custom starting point #45

Closed
wants to merge 3 commits into from
Closed

Adds support for custom starting point #45

wants to merge 3 commits into from

Conversation

Starefossen
Copy link
Contributor

This fork adds support for custom starting point.

introjs().start(2); // 2 refers to the data-step="2"

@afshinm
Copy link
Contributor

afshinm commented Mar 22, 2013

This pull request is really nice but I think it needs a little changes.
We should have a separate method like goToStep that has an step:integer parameter. This method set the current step of introduction, so we're able to go to specific step in the introduction.

Let me know what you think.

@Starefossen
Copy link
Contributor Author

Well, maybe in addition to the .start( integer step ). I mean, how would you trigger the .goToStep( integer step ) function while introjs is running? The user isn't supposed to click on any buttons or anything because the rest of the screen is grayed out.

I'm using this option to start introjs at a given step using small ? at various places on my page; assuming that if the user has reached this point all the earlier steps has been completed.

@afshinm
Copy link
Contributor

afshinm commented Mar 22, 2013

Ok ok, (you know that) we have chainable structure in introJs so you're able to do something like:

introJs().start().oncomplete(function(){ 
    //blah blah   
});

And I think it's better to do introJs().start().goToStep(2) instead of introJs().start(2) though I think we can have an parameter for start method that calls goToStep function then.
It's better to have separate small functions, it's a best practice.

@Starefossen
Copy link
Contributor Author

I did not think of that @afshinm, good point. I very much like your proposed setup!

@afshinm
Copy link
Contributor

afshinm commented Mar 22, 2013

Thanks to you @Starefossen.

@dfjones1981
Copy link

Doesn't the start() function display the first step though? If we called start() then gotostep(2) wouldn't that display the first step and then quickly switch to step 2?

@afshinm
Copy link
Contributor

afshinm commented Mar 22, 2013

@dfjones1981 Yeah, correct. I know it's not a proper behavior. I think it's better to have a paramater for start function that calls goToStep first. Then we have this sequence of function calls:

start ==> goToStep (this function sets the _currentStep to given paramter) ==> _introForElement

So it starts the introduction from the given step.

@dfjones1981
Copy link

Sounds good. Also, as long as the start() method is called last you could still make use of the method chaining pattern, for example:

introJs().goToStep(2).start()

@afshinm
Copy link
Contributor

afshinm commented Mar 22, 2013

@dfjones1981 Yeah yeah 👍

@saiful
Copy link

saiful commented Mar 24, 2013

I think it can be added a plugin like using jquery.cookies. what do you think?

@afshinm
Copy link
Contributor

afshinm commented Mar 25, 2013

@saiful Another discussion? It's better to have discussions in the project Google Group.

@afshinm
Copy link
Contributor

afshinm commented Mar 25, 2013

@Starefossen And also this pull request, I think it's really a good feature to be added for v0.3.0 of IntroJs

afshinm added a commit that referenced this pull request Mar 27, 2013
@afshinm
Copy link
Contributor

afshinm commented Mar 27, 2013

Manually added, thanks @Starefossen :)

@afshinm afshinm closed this Mar 27, 2013
@Starefossen Starefossen deleted the custom-start-wip branch June 4, 2013 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants