usablica / intro.js

Lightweight, user-friendly onboarding tour library
http://introjs.com
Other
22.8k stars 2.59k forks source link

onbeforechange should allow you to skip that step #1293

Closed jherman closed 3 years ago

jherman commented 3 years ago

The callback here should return a bool that indicates whether to skip that step. In my use case, my intro may be different based on a user's access rights. So some navigation elements may not exist for that particular user. I can detect that on the callback for onbeforechange, but I can't tell it to skip that step if that element doesn't exist.

afshinm commented 3 years ago

could you send your Introjs config + your HTML?

jherman commented 3 years ago

Just looked at the code. Looks like it does accept a boolean as return type to cancel the call. I was just going off the documentation, so perhaps the documentation just needs to be updated:

introJs.onbeforechange(providedCallback)#
Given callback function will be called before starting a new step of introduction. The callback function receives the element of the new step as an argument.

Parameters:

providedCallback : Function
Returns:

introJs object.
Example:
...
stale[bot] commented 3 years ago

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.