JsFiddle: JsFiddle
I have a bootstrap popover window and a button to call the popover out.
My goal is: I want to have Intro.js feature to introduce:
step 1: click the button;
step 2:Here is the popover window.
Intro.js provides an option that can pre-define the steps programmically. So here's my code of introjs:
var intro2 = introJs();
intro2.setOptions({
exitOnOverlayClick: true,
showBullets: false,
//showStepNumbers: false,
steps: [
{
element: document.querySelector('#saveSelection'),
intro: "Click this button to call popover window.",
position: 'top'
},
{
element: document.querySelector('.popover.fade.top.in'),
intro: "popover windown",
position: 'top'
},
],
}).setOption('doneLabel', 'Close').start();
});
But my problem is that while I was in the introJs layout(step1), it located the button but this time popover window wasn't called out. Then I went ahead to click the button, popover called out, then I click next on Introjs, it couldn't locate my popover window.
The reason probably is because when introJs was initialized at the first time. it has already scanned those elements in the steps I defined in intro2.setOptions
, but since the popover is a dynamic element so introJs couldn't find a popover named class="popover fade top in"
at the initial stage.
Same issue happened for bootstrap Modal.
Any solutions?