I am using Intro.js for a guided tour.
I would like to fire javascript functions between some of the steps but I don't manage to. An idea would be to define different intros, and fire the javascript functions between the intros.
Is there a cleaner way to do it ?
onchange: It is triggered when an HTML element changes. onclick: It is triggered when an HTML element is clicked. onmouseover: It is triggered when the mouse is moved over a HTML element. onmouseout: It is triggered when the mouse is moved out of a HTML element.
The $() function The dollar function, $(), can be used as shorthand for the getElementById function. To refer to an element in the Document Object Model (DOM) of an HTML page, the usual function identifying an element is: document.
I think I found a better solution, by setting a callback on step changes :
introJs().onchange(function(targetElement) {
console.log(targetElement.id);
switch (targetElement.id)
{
case "step1":
function1();
break;
case "step2":
function2();
break;
}
}).start();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With