问题
Does anyone know how to add an step to intro.js that can open a menu when going to the target element. I have button on the left corner of my website. When user click that button a menu will be displayed. I could not find a way in intro.js to open that menu when intro is on that step.
回答1:
It should be emphasized that the functionality is not officially supported.
Emulate a click on a specific step:
After investigating how to emulate a click when IntroJS is in a specific step see: https://github.com/usablica/intro.js/pull/380/files?short_path=04c6e90
The proposal in this feature commit is to use the:
Attribute data-click
: Show a click animation over the tooltip.
Trigger a function on each step:
I'll recommend that you emulate a click or whatever you want to do dynamically: firing a function at each step, this allows you to do more complex things.
We use onchange: function(){...}
for this.
You can set a function callback or hard-code the actions to emulate a click on the element inside the function(){}
block.
Alter step events: https://stackoverflow.com/a/42324402/3172310
Callback on step changes: https://stackoverflow.com/a/17157644/3172310
Working Example: http://www.observatoriodeviolencias.net/
来源:https://stackoverflow.com/questions/41577176/step-with-click-functionality-in-intro-js