我在我的网站上使用intro.js进行浏览。我使用bottom作为默认的工具提示位置,但是有什么方法可以在浏览开始后更改工具提示的位置吗?
下面是我的代码:
tourPluginObject=introJs();
tourPluginObject.onchange(function(targetElement) {
if($(targetElement).attr("data-step")==5 && enteredStepFive==false){
enteredStepFive=true;//I entered a step five, so mark this
tourPluginObject.setOption('tooltipPosition','left');//Set new tooltip position
tourPluginObject.setOption('data-position','left');//Set new tooltip position
tourPluginObject.refresh();//Refresh layout
}
});
tourPluginObject.setOptions({'tooltipPosition': 'bottom' });//Set default tooltip position
tourPluginObject.start();//Start tour发布于 2014-12-04 01:17:29
如果您可以修改html,则可以在元素5上添加数据属性data-position="left",并保留其他元素的位置,或者将它们全部设置为"bottom“。
这样,step5将具有所需的位置,而无需在运行时对其进行修改。
https://stackoverflow.com/questions/26791340
复制相似问题