gpt4 book ai didi

javascript - Intro.js 更改工具提示位置

转载 作者:行者123 更新时间:2023-11-29 19:32:25 25 4
gpt4 key购买 nike

我在我的网站上使用 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

最佳答案

如果可以修改html,可以在第5个元素上加上data-attribute data-position="left",其他不加position或者全部设为"底部”。

这样 step5 将具有所需的位置,而无需在运行时修改它。

关于javascript - Intro.js 更改工具提示位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26791340/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com