有没有办法通过按钮重新启动 Intro.Js?
我目前已将其设置为在页面加载时运行,并使用 JSON 中定义的步骤运行,效果很好。不过,我希望用户可以通过帮助按钮访问该导览,以便在需要时进行参考。
我努力了:
introJs().setOptions({
steps: [{
intro: "<h1>Welcome to the Map</h1>"
},
{
element: document.querySelector('#viewDiv'),
title: "The Map",
intro: "This is the main map. Right click and drag to pan, use the mouse wheel to zoom (or use the buttons in the top left corner), and left click to spin the map around. The compass icon in the top left corner will reset the map orientation to north."
},
*[MORE STEPS]*
]
}).start();
function tourRestart() {
introJs().start();
}
document.getElementById("help").addEventListener("click", tourRestart)
但这没有任何作用。如果 HTML 中还定义了步骤,则will从第一个 HTML 步骤开始,但如果可能的话,我更愿意使用 JSON 版本。
Thanks!
这是我所做的:
var introjs_element = introJs().setOptions({
steps: [{
intro: "<h1>Welcome to the Map</h1>"
},
{
element: document.querySelector('#viewDiv'),
title: "The Map",
intro: "This is the main map. Right click and drag to pan, use the mouse wheel to zoom (or use the buttons in the top left corner), and left click to spin the map around. The compass icon in the top left corner will reset the map orientation to north."
},
*[MORE STEPS]*
]
});
introjs_element.start();
function tourRestart() {
introjs_element.start();
}
document.getElementById("help").addEventListener("click", tourRestart)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)